Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

14
LINES

< > BotCompany Repo | #1036050 // bench_maskDiffing_justTheBitOp_singleArray (put all masks in one big array to improve cache locality)

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (11519L/66K).

svoid bench_maskDiffing_justTheBitOp_singleArray() {
  int maskSize = 32;
  L<long[]> images = repF(1000, -> new Image2BAsLongs(randomBinaryImage(maskSize)).pixels);
  long[] mainImage = random(images);
  int maskArraySize = l(mainImage);
  long[] bigArray = concatLongArrays(images);

  print(benchFor5(-> {
    long sum = 0;
    for (int i = 0; i < bigArray.length; i += maskArraySize)
      sum += countDifferingBits(mainImage, bigArray, i);
    ret sum;
  }));
}

Author comment

Began life as a copy of #1036048

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1036050
Snippet name: bench_maskDiffing_justTheBitOp_singleArray (put all masks in one big array to improve cache locality)
Eternal ID of this version: #1036050/1
Text MD5: 6bc5e3fa55f85d38acac27ed7e7c7131
Transpilation MD5: 3ff9a15cdcb2d7886782c8f479af0ff7
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-09-03 01:55:17
Source code size: 479 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 57 / 85
Referenced in: [show references]