attractivechaos / benchmarks Goto Github PK
View Code? Open in Web Editor NEWVarious benchmarks
Various benchmarks
std::vector is very fast. It is almost making kvec.h
obsolete. Although cl.exe optimization does influence the results greatly. As it should be expected. x64 release build results are:
C array_, preallocated: 0.397 sec
C array_, dynamic: 1.054 sec
C vector, dynamic(kv_a): 0.510 sec
C vector, dynamic(kv_push): 1.030 sec
C++ vector, preallocated: 0.453 sec
C++ vector, dynamic: 1.654 sec
cl.exe is not known as excellent C compiler so I tried with CLANG 9.0 coming pre packaged with Visual Studio 2019. These are the results :
C array_, preallocated: 0.000 sec
C array_, dynamic: 1.135 sec
C vector, dynamic(kv_a): 0.480 sec
C vector, dynamic(kv_push): 1.107 sec
C++ vector, preallocated: 0.737 sec
C++ vector, dynamic: 1.835 sec
C side is a bit more noticeably faster with CLANG.Machine is: Windows 10 pro, (old) i5, 8GB RAM, 60 GB SSD. I assume LINUX, Mac results might vary.
kvec_test.cc
has one modernization needed. Instead of:
std::vector<int> array_ ) ;
array_.reserve(N);
it should be
std::vector<int> array_( size_t(N), int(0) ) ;
// array_.reserve(N);
I also renamed array
to array_
.
I am using
Microsoft (R) C/C++ Optimizing Compiler Version 19.25.28612 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
Of course instead of std::vector
"pre-allocated", one would use std::array
, which would make things even faster. But in this program we would have instant stack overflow.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.