MUD-Dev
mailing list archive
[ Other Periods
| Other mailing lists
| Search
]
Date:
[ Previous
| Next
]
Thread:
[ Previous
| Next
]
Index:
[ Author
| Date
| Thread
]
[MUD-Dev] Question on c++ switch optimization, and parsers in general.
Well, after the 400th person said my parse engine was an insult to
hackers everywhere (I was the first of those 400!!), I am re-writing it.
Basically, I'll have a bunch of classes hashed into an array
that will contain the keywords mapped to an enum.
Now, I get the enum, and then I need to call the various commands
that the enum maps to.
Currently, I'm using a huge (~400 cases) switch statement.
So, the question is: Is that efficient? Does the compiler
generate code that does better than a linear search down the
case statements? If not, I can manually hack a sort of n-ary
tree performance into it, but I'd wrather not if I can help it.
Also, I'll be curious if anyone wants to spew forth their own ideas
on how to parse user's commands into callable methods.
Thanks,
Ben
--
Ben Greear (greear#cyberhighway,net) http://www.primenet.com/~greear
Author of ScryMUD: mud.primenet.com 4444 (Released under GPL)
http://www.primenet.com/~greear/ScryMUD/scry.html
- Follow-Ups:
- [MUD-Dev] Re: Question on c++ switch optimization, and parsers in general.
- From: Richard Woolcock <KaVir#dial,pipex.com>
- [MUD-Dev] Re: Question on c++ switch optimization, and parsers in general.
- From: Ola Fosheim Grøstad <olag#ifi,uio.no>
- [MUD-Dev] Re: Question on c++ switch optimization, and parsers in general.
- From: Adam Wiggins <adam#angel,com>
- [MUD-Dev] Re: Question on c++ switch optimization, and parsers in general.
- From: Ola Fosheim Grøstad <olag#ifi,uio.no>
- [MUD-Dev] Re: Question on c++ switch optimization, and parsers i
- From: "Jon A. Lambert" <jlsysinc#ix,netcom.com>
- Thread context:
- [MUD-Dev] Re: Question on c++ switch optimization, and parsers in general., (continued)
- [MUD-Dev] Re: Question on c++ switch optimization, and parsers i,
Chris Gray cg#ami-cg,GraySage.Edmonton.AB.CA, Mon 08 Feb 1999, 06:11 GMT
- [MUD-Dev] Question on c++ switch optimization, and parsers in general.,
Ben Greear greear#cyberhighway,net, Mon 08 Feb 1999, 05:32 GMT
- [MUD-Dev] Re: Question on c++ switch optimization, and parsers i,
Jon A. Lambert jlsysinc#ix,netcom.com, Mon 08 Feb 1999, 05:56 GMT
- [MUD-Dev] Re: Question on c++ switch optimization, and parsers in general.,
Ola Fosheim Grøstad olag#ifi,uio.no, Mon 08 Feb 1999, 16:53 GMT
[ Other Periods
| Other mailing lists
| Search
]