D performance guideline (request)

bobef bobef at abv-nospam.bg
Sat Apr 12 09:09:43 PDT 2008


Hi,

I would like to request a guideline how to squeeze every last nanosecond out of D. I am writing this scripting language - FlowerScript, and I really need to take every spare bit... But the problem is... I am a noob. D performs really well, of course, but lame people like me could make even D slow :) I know here are a lot of people that are very good programmers with broad knowledge how things work and a lot of experiene, so I would like to ask you to share your experience - what to do when every tick matters. For example one could use pointers for indexing arrays, to bypass the bounds checking. Yes, it is not that pretty but gives a big boost. I am trying to experiment with things, but sometimes it is really strange. For example I have few ifs. I rearrange them a bit. Sometimes I move one if inside other and it becomes slower, sometimes I simply add curly braces and it becomes faster. Or I wrap a block of code in a try {} and it becomes faster. Why is that? If I wrap every line of code in try, will I make it fly ? :D

Thanks,
bobef



More information about the Digitalmars-d mailing list