[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

optparse

Charles Mills

1/12/2005 3:33:00 PM

We recently switched to using optparse from getoptlong in the DBC for C
project, because optparse is much more flexible and generally just
better.

Is there any way to parse options of the form '-word arg' like
'-include "config.h"'?

Also noticed their is a preformance price for using optparse.
Switching to optparse from getoptlong slowed down the main benchmark we
run from ~3.5sec to about ~4.5sec. Isn't that big of a deal I guess,
but food for thought.

-Charlie

12 Answers

Eric Hodel

1/12/2005 6:46:00 PM

0

On 12 Jan 2005, at 07:36, Charles Mills wrote:

> Also noticed their is a preformance price for using optparse.
> Switching to optparse from getoptlong slowed down the main benchmark we
> run from ~3.5sec to about ~4.5sec. Isn't that big of a deal I guess,
> but food for thought.

What kind of hardware are you running, and how many options do you
have? I can't imagine how many options you have that adds an extra
second to runtime.

--
Eric Hodel - drbrain@segment7.net - http://se...
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04

Charles Mills

1/12/2005 7:46:00 PM

0

Eric Hodel wrote:
> On 12 Jan 2005, at 07:36, Charles Mills wrote:
>
> > Also noticed their is a preformance price for using optparse.
> > Switching to optparse from getoptlong slowed down the main
benchmark we
> > run from ~3.5sec to about ~4.5sec. Isn't that big of a deal I
guess,
> > but food for thought.
>
> What kind of hardware are you running, and how many options do you
> have? I can't imagine how many options you have that adds an extra
> second to runtime.

12 options. Running a 1ghz powerbook.

Any idea about the first question? Seems like you can only do "--word
arg" or "-c arg", not "-word arg".

-Charlie

djberg96

1/12/2005 9:39:00 PM

0

Does running it through the profiler provide any insight?
As to your other question, I'm afraid I just don't know.

Dan

Glenn Parker

1/12/2005 9:50:00 PM

0

Charles Mills wrote:
>
> Any idea about the first question? Seems like you can only do "--word
> arg" or "-c arg", not "-word arg".

I think that's the style you get. A double hypen is always followed by
a long option name. A single hyphen is always followed by a one-letter
option flag.

--
Glenn Parker | glenn.parker-AT-comcast.net | <http://www.tetrafoi...


Robert Klemme

1/12/2005 10:07:00 PM

0


"Glenn Parker" <glenn.parker@comcast.net> schrieb im Newsbeitrag
news:41E59B7C.5050100@comcast.net...
> Charles Mills wrote:
>>
>> Any idea about the first question? Seems like you can only do "--word
>> arg" or "-c arg", not "-word arg".
>
> I think that's the style you get. A double hypen is always followed by a
> long option name. A single hyphen is always followed by a one-letter
> option flag.

I'm not 100% sure but that might even be POSIX standard. Anyway, IMHO it's
a good convention to follow.

robert

> --
> Glenn Parker | glenn.parker-AT-comcast.net | <http://www.tetrafoi...
>
>

Charles Mills

1/12/2005 10:25:00 PM

0


Daniel Berger wrote:
> Does running it through the profiler provide any insight?
> As to your other question, I'm afraid I just don't know.
>

So I ran it through the profiler and the last line below jumped out at
me.

% cumulative self self total
time seconds seconds calls ms/call ms/call name
12.22 5.00 5.00 3759 1.33 3.38
Preprocessor::Tokens#shift
11.78 9.82 4.82 4055 1.19 1.58
CTokenizer::Lexer#shift
6.38 12.43 2.61 667 3.91 10.69 Array#each
4.25 14.17 1.74 21566 0.08 0.08 Array#at
4.23 15.90 1.73 1553 1.11 1.62
CTokenizer::Scoped.process_scope
4.06 17.56 1.66 1550 1.07 14.74 Kernel.loop
3.72 19.08 1.52 20222 0.08 0.08 Kernel.==
3.08 20.34 1.26 1483 0.85 19.82 DBC::Parser#shift
2.86 21.51 1.17 1553 0.75 16.37
Preprocessor::Parser#shift
2.76 22.64 1.13 383 2.95 127.36
Racc::Parser#_racc_do_parse_c
(...)
0.15 38.69 0.06 13 4.62 43.08
OptionParser#make_switch
0.15 38.75 0.06 50 1.20 1.80
CType::Parser#_reduce_113
0.12 38.80 0.05 81 0.62 0.62
CTokenizer::Splitter#reset
0.12 38.85 0.05 302 0.17 0.33
Preprocessor::Parser#_reduce_1
0.12 38.90 0.05 122 0.41 0.41 Hash#include?
0.12 38.95 0.05 366 0.14 0.14 Hash#[]=
0.12 39.00 0.05 105 0.48 1.62
CTokenizer::Splitter#shift
0.12 39.05 0.05 38 1.32 1.32 Hash#invert
0.12 39.10 0.05 54 0.93 4.81
Array#reverse_each
0.12 39.15 0.05 135 0.37 0.37
CType::Parser#_reduce_114
0.12 39.20 0.05 135 0.37 1.48
CType::Parser#_reduce_116
0.12 39.25 0.05 556 0.09 0.09 Array#<<
0.10 39.29 0.04 76 0.53 34.74
Preprocessor::Parser#_reduce_9
0.10 39.33 0.04 58 0.69 0.69
CType::Parser#_reduce_165
0.10 39.37 0.04 19 2.11 11.58
OptionParser::List#update
0.10 39.41 0.04 1 40.00 820.00
OptionParser#initialize
(...)

It may just be optparse creates more objects causing the GC to run more
often.

-Charlie

Charles Mills

1/12/2005 10:28:00 PM

0


Robert Klemme wrote:
> "Glenn Parker" <glenn.parker@comcast.net> schrieb im Newsbeitrag
> news:41E59B7C.5050100@comcast.net...
> > Charles Mills wrote:
> >>
> >> Any idea about the first question? Seems like you can only do
"--word
> >> arg" or "-c arg", not "-word arg".
> >
> > I think that's the style you get. A double hypen is always
followed by a
> > long option name. A single hyphen is always followed by a
one-letter
> > option flag.
>
> I'm not 100% sure but that might even be POSIX standard. Anyway,
IMHO it's
> a good convention to follow.
>
Agreed. I am trying to mimic a few of gcc's command line options and
'-include file' is one of them. Looking at gcc's man page, they
certainly don't follow the double hyphen convention :(

-Charlie

Jon°

9/24/2008 4:17:00 PM

0

On Sep 24, 1:10 pm, parri...@yahoo.com wrote:
> On 24 Sep, 11:38, Jon° <oh_jon...@live.co.uk> wrote:
>
> > The scientists involved said that nothing could go wrong with their
> > Large Hadron Collider  
>
> Incorrect.
>
> > and that there was no chance of them creating a
> > black hole that would swallow the Earth and our solar system………..Then
> > after just a few days their machine starts to leak
>
> Incorrect.
>
> > and they have to
> > shut it down It will be three months or so before they can continue
> > their experiment one can only pray that they know what they are doing.
>
> No one could ever accuse you of being "too clever by half" could they?
> Or even "half clever enough".

Another brainless “cucking-funt “who has to make something out of
nothing. My post was meant to be tongue in cheek but I expect you
would have understood it better if had been tongue up arse?

Even then though, there was a smattering of truth in it, I show this
in the links below......You though don't bother to prove any
statements you make, you just haughtily state “incorrect”, who the
fuck do you think you are, from other posts I have seen of yours, in
the past, you are a complete masturbator without a thought in your
dimwit head. Probably a teenage wanker as well who is going through
his “I am the greatest” period.

So try and learn a thing or two sonny, before you make statements that
you obviously know nothing
about………………………….AAAAAAAAAAAghhhhhhhgh!!!------- Of all the puny “bhit-
sags” I have met on these Ng’s you are, easily, the crassest piece of
dehydrated excrement of them all.

http://news.sky.com/skynews/Home/World-News/Large-Hadron-Collider-Breaks-Down-Cern-Says-Big-Bang-Machine-Out-Of-Action-Until-2009/Article/200809415105916?lid=ARTICLE_15105916_LargeHadronColliderBreaksDown:CernSaysBigBangMachineOutOfActionUntil2009&lpos=sea...

'Big Bang Machine' Breaks Down

The £3.6bn machine at the centre of the biggest scientific experiment
the world has ever seen has broken down and will be out of action
until next year.

The Large Hadron Collider (LHC) near Geneva, designed to re-create
conditions cosmologists agree existed at the beginning of the
universe, was switched on two weeks ago.
It fires beams of particles around a 16.8-mile tunnel at near light
speed with the aim of smashing them in to each other to mimic the
effects of the Big Bang.
The machine created a sensation around the world not just because of
its record cost and scale but because of claims it might cause a black
hole to form that would swallow the planet.

Those in charge of the project at the European Organisation for
Nuclear Research (Cern) dismissed the concerns.

Now, though, they have revealed that a large amount of helium leaked
into the tunnel on Friday, forcing the particle accelerator to be shut
down.

http://www.telegraph.co.uk/earth/main.jhtml?xml=/earth/2008/09/19/sci...

The Large Hadron Collider, the world's largest particle collider,
malfunctioned within hours of its launch, but its operator did not
report the problem for a week. By Chris Irvine.






Jon°

9/25/2008 4:07:00 AM

0

On Sep 25, 12:38 am, FriarTuck <n...@invalid.com> wrote:
> On Wed, 24 Sep 2008 23:36:34 +0000, FriarTuck wrote:
> > On Wed, 24 Sep 2008 21:43:49 +0200, Lou Ravi wrote:
>
> >> Indeed again. There is no leak, there is a problem with a magnet, a
> >> very, very powerful magnet.
>
> > what are you on about?
>
> > there was a leak of helium, which cools the magnet... there may now be
> > other problems they are admitting to as well, but there was definitely a
> > helium leak.
>
> well... if news reports are anything to go by...
>
> so maybe the helium leak story was the least worst option to run with....

http://news.sky.com/skynews/Home/World-News/Large-Hadron-Collider-Breaks-Down-Cern-Says-Big-Bang-Machine-Out-Of-Action-Until-2009/Article/200809415105916?lid=ARTICLE_15105916_LargeHadronColliderBreaksDown:CernSaysBigBangMachineOutOfActionUntil2009&lpos=sea...


“Now, though, they have revealed that a large amount of helium leaked
into the tunnel on Friday, forcing the particle accelerator to be shut
down.”

"quod erat demonstrandum"

parris_k

9/25/2008 10:44:00 AM

0

On 24 Sep, 17:12, Jon° <oh_jon...@live.co.uk> wrote:
> On Sep 24, 1:10 pm, parri...@yahoo.com wrote:
>
>
>
>
>
> > On 24 Sep, 11:38, Jon° <oh_jon...@live.co.uk> wrote:
>
> > > The scientists involved said that nothing could go wrong with their
> > > Large Hadron Collider  
>
> > Incorrect.
>
> > > and that there was no chance of them creating a
> > > black hole that would swallow the Earth and our solar system………...Then
> > > after just a few days their machine starts to leak
>
> > Incorrect.
>
> > > and they have to
> > > shut it down It will be three months or so before they can continue
> > > their experiment one can only pray that they know what they are doing.
>
> > No one could ever accuse you of being "too clever by half" could they?
> > Or even "half clever enough".
>
> Another brainless “cucking-funt “who has to make something out of
> nothing.

That would be a pretty accurate descpripton of you, yes.


> My post was meant to be tongue in cheek but I expect you
> would have understood it better if had been tongue up arse?

My dear Oscar, I wish I'd said that...


>
> Even then though, there was a smattering of truth in it, I show this
> in the links below......You though don't bother to prove any
> statements you make,  you just  haughtily state “incorrect”, who the
> fuck do you think you are, from other posts I have seen of yours, in
> the past, you are a complete masturbator  without a thought in your
> dimwit head. Probably a teenage wanker as well who is going through
> his “I am the greatest” period.

Gosh.. what an angry little man you are.

Tell you what, produce a cite from a scientist invoved where he says
"nothing could go wrong with their Large Hadron Collider".

<snip further ranting>