msg00353.html
1999Q1/msg00353.html · 8.1 KB
From the archive 1999Q1.zip
Download the archive « Back to the archive contents
<!-- MHonArc v2.4.4 -->
<!--X-Subject: [MUD-Dev] Question on c++ switch optimization, and parsers in general. -->
<!--X-From-R13: Pra Uerrne <terrneNploreuvtujnl.arg> -->
<!--X-Date: Sun, 7 Feb 1999 21:32:07 -0800 -->
<!--X-Message-Id: 36BE7019.241FB974#cyberhighway,net -->
<!--X-Content-Type: text/plain -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, [MUD-Dev] Question on c++ switch optimization, and parsers in </title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:greear#cyberhighway,net">
</head>
<body background="/backgrounds/paperback.gif" bgcolor="#ffffff"
text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000">
<font size="+4" color="#804040">
<strong><em>MUD-Dev<br>mailing list archive</em></strong>
</font>
<br>
[ <a href="../">Other Periods</a>
| <a href="../../">Other mailing lists</a>
| <a href="/search.php3">Search</a>
]
<br clear=all><hr>
<!--X-Body-Begin-->
<!--X-User-Header-->
<!--X-User-Header-End-->
<!--X-TopPNI-->
Date:
[ <a href="msg00352.html">Previous</a>
| <a href="msg00354.html">Next</a>
]
Thread:
[ <a href="msg00367.html">Previous</a>
| <a href="msg00354.html">Next</a>
]
Index:
[ <A HREF="author.html#00353">Author</A>
| <A HREF="#00353">Date</A>
| <A HREF="thread.html#00353">Thread</A>
]
<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>[MUD-Dev] Question on c++ switch optimization, and parsers in general.</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI>
<LI><em>Subject</em>: [MUD-Dev] Question on c++ switch optimization, and parsers in general.</LI>
<LI><em>From</em>: Ben Greear <<A HREF="mailto:greear#cyberhighway,net">greear#cyberhighway,net</A>></LI>
<LI><em>Date</em>: Sun, 07 Feb 1999 22:03:21 -0700</LI>
<LI><em>Reply-To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>
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) <A HREF="http://www.primenet.com/~greear">http://www.primenet.com/~greear</A>
Author of ScryMUD: mud.primenet.com 4444 (Released under GPL)
<A HREF="http://www.primenet.com/~greear/ScryMUD/scry.html">http://www.primenet.com/~greear/ScryMUD/scry.html</A>
</PRE>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<ul compact><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><A NAME="00362" HREF="msg00362.html">[MUD-Dev] Re: Question on c++ switch optimization, and parsers in general.</A></strong>
<ul compact><li><em>From:</em> Richard Woolcock <KaVir#dial,pipex.com></li></ul>
<li><strong><A NAME="00361" HREF="msg00361.html">[MUD-Dev] Re: Question on c++ switch optimization, and parsers in general.</A></strong>
<ul compact><li><em>From:</em> Ola Fosheim Grøstad <olag#ifi,uio.no></li></ul>
<li><strong><A NAME="00357" HREF="msg00357.html">[MUD-Dev] Re: Question on c++ switch optimization, and parsers in general.</A></strong>
<ul compact><li><em>From:</em> Adam Wiggins <adam#angel,com></li></ul>
<li><strong><A NAME="00356" HREF="msg00356.html">[MUD-Dev] Re: Question on c++ switch optimization, and parsers in general.</A></strong>
<ul compact><li><em>From:</em> Ola Fosheim Grøstad <olag#ifi,uio.no></li></ul>
<li><strong><A NAME="00354" HREF="msg00354.html">[MUD-Dev] Re: Question on c++ switch optimization, and parsers i</A></strong>
<ul compact><li><em>From:</em> "Jon A. Lambert" <jlsysinc#ix,netcom.com></li></ul>
</UL></LI></UL>
<!--X-Follow-Ups-End-->
<!--X-References-->
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00352.html">[MUD-Dev] client images</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00354.html">[MUD-Dev] Re: Question on c++ switch optimization, and parsers i</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00367.html">[MUD-Dev] Re: Question on c++ switch optimization, and parsers i</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00354.html">[MUD-Dev] Re: Question on c++ switch optimization, and parsers i</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00353"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00353"><STRONG>Thread</STRONG></A></LI>
</UL>
</LI>
</UL>
<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
<ul><li>Thread context:
<BLOCKQUOTE><UL>
<LI><STRONG>[MUD-Dev] Re: Question on c++ switch optimization, and parsers in general.</STRONG>, <EM>(continued)</EM>
<ul compact>
<LI><strong><A NAME="00368" HREF="msg00368.html">[MUD-Dev] Re: Question on c++ switch optimization, and parsers in general.</A></strong>,
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Tue 09 Feb 1999, 03:54 GMT
<UL>
<LI><strong><A NAME="00370" HREF="msg00370.html">[MUD-Dev] Re: Question on c++ switch optimization, and parsers in general.</A></strong>,
T. Alexander Popiel <a href="mailto:popiel#snugharbor,com">popiel#snugharbor,com</a>, Tue 09 Feb 1999, 04:41 GMT
</LI>
</UL>
</LI>
</ul>
</LI>
<LI><strong><A NAME="00355" HREF="msg00355.html">[MUD-Dev] Re: Question on c++ switch optimization, and parsers i</A></strong>,
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Mon 08 Feb 1999, 06:11 GMT
<UL>
<li><Possible follow-up(s)><br>
<LI><strong><A NAME="00367" HREF="msg00367.html">[MUD-Dev] Re: Question on c++ switch optimization, and parsers i</A></strong>,
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Tue 09 Feb 1999, 03:45 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00353" HREF="msg00353.html">[MUD-Dev] Question on c++ switch optimization, and parsers in general.</A></strong>,
Ben Greear <a href="mailto:greear#cyberhighway,net">greear#cyberhighway,net</a>, Mon 08 Feb 1999, 05:32 GMT
<UL>
<LI><strong><A NAME="00354" HREF="msg00354.html">[MUD-Dev] Re: Question on c++ switch optimization, and parsers i</A></strong>,
Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Mon 08 Feb 1999, 05:56 GMT
<UL>
<LI><strong><A NAME="00364" HREF="msg00364.html">[MUD-Dev] Re: Question on c++ switch optimization, and parsers i</A></strong>,
Ben Greear <a href="mailto:greear#cyberhighway,net">greear#cyberhighway,net</a>, Tue 09 Feb 1999, 02:46 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00356" HREF="msg00356.html">[MUD-Dev] Re: Question on c++ switch optimization, and parsers in general.</A></strong>,
Ola Fosheim Grøstad <a href="mailto:olag#ifi,uio.no">olag#ifi,uio.no</a>, Mon 08 Feb 1999, 16:53 GMT
<UL>
<LI><strong><A NAME="00365" HREF="msg00365.html">[MUD-Dev] Re: Question on c++ switch optimization, and parsers in general.</A></strong>,
Ben Greear <a href="mailto:greear#cyberhighway,net">greear#cyberhighway,net</a>, Tue 09 Feb 1999, 02:54 GMT
</LI>
</UL>
</LI>
</UL>
</LI>
</UL></BLOCKQUOTE>
</ul>
<hr>
<center>
[ <a href="../">Other Periods</a>
| <a href="../../">Other mailing lists</a>
| <a href="/search.php3">Search</a>
]
</center>
<hr>
</body>
</html>