Giter Site home page Giter Site logo

pahihu / countwords Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 1.4 MB

Ben Hoyt' counting words benchmarks

PicoLisp 0.70% q 0.30% C 13.26% C++ 5.95% Forth 40.51% Shell 4.11% Roff 1.70% Awk 0.27% Common Lisp 3.40% Ada 6.04% Component Pascal 11.68% Java 5.68% Python 1.39% Rebol 0.81% Smalltalk 2.21% Scheme 1.98%

countwords's Introduction

Count words

On comp.lang.forth Ben Hoyt posted a problem of counting word frequencies. His conclusions can be found at Performance comparisons.

The picoLisp and Ada entry is a modified version of a Rosetta-code problem.

My conclusions:

  • the fastest is the optimized C, which is 6x faster than the AWK entry
  • if I type 60x more characters than the K version, then I can get 10x speedup with C
  • compiled SBCL is 2x faster than interpreted picoLisp
  • AWK is faster than simple C++

Comparison

Time Language
1.3 C (simple)
1.8 AWK
1.9 C++ (simple)
2.9 SBCL
3.0 K
4.6 Python
5.7 CHICKEN
6.4 picoLisp
7.0 REBOL2
9.7 Squeak

Results

Language Chars Elapsed time
K 74 3.0
Shell 84 11.0
AWK 141 1.8
Python3 (Norwig) 275 4.6
8th 317 3.3
picoLisp 373 6.4
REBOL2 429 7.0
Python3 464 2.3
Squeak 475 9.7
C++ (simple) 812 1.9
CHICKEN 1050 5.7
SBCL 1325 2.9
ECL 1325 9.0
ClozureCL 1325 9.1
C++ 2304 0.5
C (simple) 2375 1.3
Java 2870 2.1
GForth 3003 1.8
iForth 4108 0.5
SwiftForth 4173 0.6
C 4295 0.3
ComponentPascal 6191 0.8

pahihu 6aug2021

countwords's People

Contributors

pahihu avatar

Stargazers

Starring Forth avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.