From: skaller <sk...@us...> - 2004-12-24 11:05:18
|
On Fri, 2004-12-24 at 11:31, Janne Hellsten wrote: > Since I guess people are not willing to stop using unsafe_get/put (at > least not completely), we should think of some other way to achieve > bounds checking so that it doesn't hurt performance. Why doesn't just the usual get/put and compilation with -unsafe for a production build work? I mean that's the idea of -unsafe isn't it? My guess is that bytecode should always do the check, and native code never. Bytecode is slower, however the bounds check for bytecode is probably *relatively* faster (i.e. a smaller fraction of the access time than for native code). >The debug build would always have >assertions on and thus be slower. However, it would only be used for >testing purposes. Hmm. Sometimes, functions have preconditions which assertions can check. If the assertion is in the function, and debugging is off in a production build, a *client error* can't be detected. This kind of check isn't an internal consistency check.. in theory, the precondition should be checked in the client code -- I'm planning this for Felix, but most programming systems don't support precondition checking in the calling code, only in the called code. So I would question whether the debugging version shouldn't also be available to end users... Why not change the Extlib build to make both? Then the client can switch between debug and production by changing libraries on the command line? -- John Skaller, mailto:sk...@us... voice: 061-2-9660-0850, snail: PO BOX 401 Glebe NSW 2037 Australia Checkout the Felix programming language http://felix.sf.net |