benchmarking

Python Slice Assignment Memory Usage

强颜欢笑 提交于 2019-11-27 01:01:44
I read in a comment here on Stack Overflow that it is more memory efficient to do slice assignment when changing lists. For example, a[:] = [i + 6 for i in a] should be more memory efficient than a = [i + 6 for i in a] because the former replaces elements in the existing list, while the latter creates a new list and rebinds a to that new list, leaving the old a in memory until it can be garbage collected. Benchmarking the two for speed, the latter is slightly quicker: $ python -mtimeit -s 'a = [1, 2, 3]' 'a[:] = [i + 6 for i in a]' 1000000 loops, best of 3: 1.53 usec per loop $ python -mtimeit

HTTPS vs HTTP speed comparison

余生颓废 提交于 2019-11-27 00:57:41
问题 Update 2013-04-25: This is a popular question that is getting more attention than it probably should. In order to stop the spread of misinformation please read the following paragraphs and the accompanying article first: Speed should not be a factor in deciding whether to use HTTPS or HTTP. If you need HTTPS for any part of your site (log-ins, registration, credit cards, etc), you absolutely need HTTPS for all of it , all the time. Please read SSL is not about encryption by Troy Hunt for the

Benchmarking VBA Code

强颜欢笑 提交于 2019-11-27 00:29:00
What is considered the most accurate way to benchmark VBA code (in my case, I am testing code in Excel)? Are there any other techniques for benchmarking code besides the 2 below, and if so, what are the pros/cons of the method? Here are 2 popular methods. First: Timer Sub TimerBenchmark() Dim benchmark As Double benchmark = Timer 'Do your code here MsgBox Timer - benchmark End Sub And Tick (which I see argued as the most accurate): Option Explicit Private Declare Function GetTickCount Lib "kernel32" () As Long Sub TickBenchmark() Dim Start As Long Dim Finish As Long Start = GetTickCount() 'Do

SQLite Performance Benchmark — why is :memory: so slow…only 1.5X as fast as disk?

浪子不回头ぞ 提交于 2019-11-27 00:19:17
Why is :memory: in sqlite so slow? I've been trying to see if there are any performance improvements gained by using in-memory sqlite vs. disk based sqlite. Basically I'd like to trade startup time and memory to get extremely rapid queries which do not hit disk during the course of the application. However, the following benchmark gives me only a factor of 1.5X in improved speed. Here, I'm generating 1M rows of random data and loading it into both a disk and memory based version of the same table. I then run random queries on both dbs, returning sets of size approx 300k. I expected the memory

Why is splitting a string slower in C++ than Python?

怎甘沉沦 提交于 2019-11-26 23:47:55
问题 I'm trying to convert some code from Python to C++ in an effort to gain a little bit of speed and sharpen my rusty C++ skills. Yesterday I was shocked when a naive implementation of reading lines from stdin was much faster in Python than C++ (see this). Today, I finally figured out how to split a string in C++ with merging delimiters (similar semantics to python's split()), and am now experiencing deja vu! My C++ code takes much longer to do the work (though not an order of magnitude more, as

How much faster is Redis than mongoDB?

二次信任 提交于 2019-11-26 23:45:35
问题 It's widely mentioned that Redis is "Blazing Fast" and mongoDB is fast too. But, I'm having trouble finding actual numbers comparing the results of the two. Given similar configurations, features and operations (and maybe showing how the factor changes with different configurations and operations), etc, is Redis 10x faster?, 2x faster?, 5x faster? I'm ONLY speaking of performance. I understand that mongoDB is a different tool and has a richer feature set. This is not the "Is mongoDB better

Benchmarking (python vs. c++ using BLAS) and (numpy)

天涯浪子 提交于 2019-11-26 23:30:32
I would like to write a program that makes extensive use of BLAS and LAPACK linear algebra functionalities. Since performance is an issue I did some benchmarking and would like know, if the approach I took is legitimate. I have, so to speak, three contestants and want to test their performance with a simple matrix-matrix multiplication. The contestants are: Numpy, making use only of the functionality of dot . Python, calling the BLAS functionalities through a shared object. C++, calling the BLAS functionalities through a shared object. Scenario I implemented a matrix-matrix multiplication for

Is stopwatch benchmarking acceptable?

时光怂恿深爱的人放手 提交于 2019-11-26 21:31:25
Does anyone ever use stopwatch benchmarking, or should a performance tool always be used? Are there any good free tools available for Java? What tools do you use? To clarify my concerns, stopwatch benchmarking is subject to error due to operating system scheduling. On a given run of your program the OS might schedule another process (or several) in the middle of the function you're timing. In Java, things are even a little bit worse if you're trying to time a threaded application, as the JVM scheduler throws even a little bit more randomness into the mix. How do you address operating system

Speed/best practice flushing mysqli_multi_query()

可紊 提交于 2019-11-26 21:19:11
问题 I cringed when Sebastien stated he was disconnecting & reconnecting between each use of mysqli_multi_query() @ Can mysqli_multi_query do UPDATE statements? because it just didn't seem like best practice. However, Craig @ mysqli multi_query followed by query stated in his case that it was faster to disconnect & reconnect between each use of mysqli_multi_query() than to employ mysqli_next_result() . I would like to ask if anyone has further first-hand knowledge or benchmark evidence to suggest

Java benchmarking tool

ε祈祈猫儿з 提交于 2019-11-26 20:59:01
问题 I have written a small java application for which I need to obtain performance metrics such as memory usage, running time etc., Is there any simple to use performance measurement tool available? 回答1: Yourkit is pretty good (free 30 day trial). Eclipse also has built in TPTP tools. 回答2: Apache JMeter has a ton of features, for benchmarking http requests, JDBC calls, web services, JMS, mail, regular Java requests, etc. 回答3: For runtime metrics, use any profiler such as VisualVM, Netbeans