Skip to main content

All Questions

3 votes
2 answers
69 views

Reading a file into lines (benchmarking getline() vs mmap_memchr() vs mmap_getline() vs fread())

This is a follow-up to: Reading a file into lines with mmap vs getline. The actual names of the functions are not ...
Harith's user avatar
  • 9,462
7 votes
1 answer
232 views

Reading a file into lines with mmap vs getline

I required a function to read a file into lines for a text editor, and ended up with two routines. One uses getline(), and the other uses ...
Harith's user avatar
  • 9,462
1 vote
0 answers
129 views

Making Robert Tarjan's offline LCA algorithm run (much) faster (Java)

I have produced this GitHub repository that compares the performance of: Robert Tarjan's off-line lowest common ancestors algorithm, An improvement of the above algorithm. Typical demo program ...
coderodde's user avatar
  • 28.9k
1 vote
1 answer
66 views

Comparing two general LCA algorithms in Java

Now I have two algorithms solving a problem: given a general (multi-way) tree, and any array of node names, find the the node that is the deepest common ancestor. ...
coderodde's user avatar
  • 28.9k
6 votes
2 answers
137 views

Concatenating prefix of one array with the reversed suffix of another array

Given two arrays and two indices, I need to concatenate the prefix of the first array and the reversed prefix of the second array. For example: ...
goodvibration's user avatar
3 votes
1 answer
471 views

Benchmark switch, binary search and if-else

Just for curiosity I have done some benchmark for testing the best performance between switch, binary-search, and if-else statement. here is the code : ...
Gujarat Santana's user avatar
3 votes
3 answers
154 views

Write the running time to file without capturing the program's output

I want to run an application and write (append) its processing time into a file. Also, I want to see the stdout and stderr output on the shell, but don't want to write it in a file. After running the ...
Lars-Daniel Weber's user avatar
3 votes
2 answers
1k views

Timing Python functions in two ways

When reviewing questions here on Code Review SE, I sometimes find my self wanting to test different functions in order to do a performance review. However since I'm inherently lazy, I wonder what is ...
holroy's user avatar
  • 11.5k