Errata [entries|reading|network|archive]
simont

[ userinfo | dreamwidth userinfo ]
[ archive | journal archive ]

Fri 2011-03-18 13:33
Errata
LinkReply
[personal profile] gerald_duckFri 2011-03-18 19:55
If you're down to cycle-shaving, surely your for loop spells disaster? That the list is cyclic is not so intrinsic that the optimiser can spot it and the null check in elephant ? elephant != head : (elephant = head) != NULL will have to be performed each time round the loop.
Link Reply to this | Parent | Thread
[identity profile] cartesiandaemon.livejournal.comSat 2011-03-19 15:42
I know what you mean, but once I got my head round the conversation, Simon's description made sense to me: if you want to traverse the circle more often than you want to do anything which involves treating the head=null case specially, then the circular implementation without distinguished elements is conceptually simpler, and gives you the freedom to write extremely optimised assembly later, at any point it's needed, even if in the meantime you only have a simple loop.
Link Reply to this | Parent
navigation
[ go | Previous Entry | Next Entry ]
[ add | to Memories ]