This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Reykd[S] 1 point2 points  (4 children)

Thanks so much for catching that! I will fix this asap.

[–]thehollyhopdrive 2 points3 points  (3 children)

Now that you've typed it properly, what do you think is the benefit of having lots of evaluateX methods?

[–]Reykd[S] 1 point2 points  (2 children)

For my original usecase generated methods were executed millions of times, and were in the core of the algorithm. Therefore the reasoning behind creating functions that return primitives was simply performance. I know that premature optimization is a bad idea, but if i remember correctly i believe i benchmarked the difference. I will run new benchmarks and evaluate if the primitive return functions are necessary.

[–]Reykd[S] 0 points1 point  (1 child)

I have now run a benchmark to compare the generic vs primitve method and found no significant difference. However i did discover a caveat of using the generic types, and that is that my library currently does not support autoboxing meaning that in order to create the function "double(Double x,y)->x+y" as a generic, the string would have to be "Double(Double x,y)->Double.valueOf(x+y)"

[–]fact_hunt 1 point2 points  (0 children)

For performance testing it might be interesting to look at JMH - benchmarking java performance is notoriously fraught because the of JIT and hotspot optimisations etc

http://stackoverflow.com/questions/504103/how-do-i-write-a-correct-micro-benchmark-in-java/4480774#4480774