Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

How fast do I type?

by zdog (Priest)
on Sep 10, 2001 at 06:02 UTC ( #111375=CUFP: print w/replies, xml ) Need Help??

I was talking to Petruchio and others about typing speed the other day and to get a rough estimate of mine, I came up with a little program which I broke down to a one-liner:

perl -e'$x=time;print scalar(split/ /,<>)/(time-$x)*60'

It returns the number of WPM (words per minute) you type. (Tested with Perl 5.6.1)

Suggestions to make this more accurate are very welcome.

Zenon Zabinski | zdog |

Replies are listed 'Best First'.
Re: How fast do I type?
by monkeygirl (Pilgrim) on Sep 10, 2001 at 21:37 UTC

    The standard method for calculating words for the purpose of finding WPM is counting all the characters and dividing by six. Why six? Because the average word is 5 characters long, plus a space.

    I'm really no good at one-liners or golfing, but I quickly modified your code. It obtains the accuracy you're looking for. Tested on ActivePerl Build 629 (Perl v5.6.1).

    #!perl $x=time; $letters=scalar(split//,<>)/6; print $letters/(time-$x)*60;

    If Bill Gates can name a company after his "bedroom" problems, I can have a stupid sig that points it out.
      golfed .... with line breaks and prefix
      perl -e'$x=time;print "WPM:".(scalar(split//,<>)/6)/(time-$x)*60."\n"'
        subtract ."\n" and add e (thanks once again to chipmunk)
        perl -le'$x=time;print "WPM:".(scalar(split//,<>)/6)/(time-$x)*60'
Re: How fast do I type?
by dga (Hermit) on Sep 14, 2001 at 03:02 UTC
    use Time::HiRes qw(time);

    This will give you a floating point time function instead of integer seconds.

    In the current program you will have to type a really long line so that the division errors like 4.9 seconds which will sometimes be 4 seconds and sometimes be 5 seconds which will cause a 25% change in your typing WPM.

    The floating poing time function will fix this up since the steps will be on the order of 0.01 seconds rather than 1 second which will improve the granularity of your estimate 100 times so that a one step change from 4.99 to 5.00 will result in a 0.25% change in the WPM figure.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://111375]
Approved by root
[LanX]: fun, last time I was in Britain people had problems with my name, just rarely they said "like the children TV star Rolf Harris?", this time most replied instantly "Rolf? like the pedophile Rolf Harris" ?
LanX is perlophile
[ambrus]: Corion: read https://metacpan. org/pod/release/ MLEHMANN/AnyEvent- 7.13/lib/AnyEvent. pm#SUPPLYING-YOUR- OWN-EVENT-MODEL- INTERFACE in that case

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2016-12-08 12:01 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (141 votes). Check out past polls.