1. Re: Scramble and routine_id
David Cuny writes:
> I've read the suggestion on scrambling code a number
> of times through, and
> each time I like it less and less. So I vote a strong no against it.
I don't like it either. I've pretty much decided to implement
a solution to this that will:
* not put a burden on the user to have to think about it
* not try to defeat the "super hacker"
* not waste too much of my time, or add too much code
to ex.exe/exw.exe
How would you feel if only the first occurrence of each
exposed routine name were plainly visible in the file?
i.e. the definition but none of the call points.
I've also considered doing your byte-code shuffling thing.
It would be fairly easy, but I don't really want to do it at this time.
> On a similar thread, just how expensive is a call using
> routine_id? I haven't bothered to benchmark it, but Pete
> tells me that it's 2 1/2 times slower than a regular call.
>I was under the impression that there was closer to a
> 10% overhead cost. Any estimates?
The benchmark code below might help you.
I tried a 0-argument call to an empty routine
and found that a direct call took 5.27 seconds
for 10 million of them on a Pentium-150,
while an indirect call took 7.36. However, if
you go to a 3-arg call it was 13.24 vs. 24.33.
I think I misled you several months ago, when I
said 10%. At that time, I had just finished writing the code
and it looked like the indirect call opcode would
have very little extra overhead. That is actually
true. The problem is that you must pass a sequence
of arguments, and the creation and destruction
of that sequence consumes a significant chunk
of time. Maybe I can optimize it somehow.
(A sequence of literal numbers actually takes a bit
of run-time to create. It's better to store it
in a constant variable.)
Regards,
Rob Craig
Rapid Deployment Software
--- start ----
procedure dummy(integer a, integer b,integer c)
end procedure
integer dummy_id
dummy_id = routine_id("dummy")
atom t
t = time()
for i = 1 to 10000000 do
dummy(1,2,3)
end for
?time()-t
t = time()
for i = 1 to 10000000 do
call_proc(dummy_id, {1,2,3})
end for
?time()-t
--- end ---