FAQ Database Discussion Community


z3py: Can the switch of the orders of constraints affect the performance of the Z3 SMT solver?

performance,z3,smt,z3py
I am trying to improve the performance of my z3py code for making an inference. Do you think changing the sequence that the logic constraint being added to the solver might possibly help?

Angular ng-repeat cache (avoid re-rendering on state change)

javascript,angularjs,performance,caching,angularjs-ng-repeat
We have huge rendering spikes with ng-repeat in Angular application. Main page shows a huge list of cover images ("::" and "track by" are in place). On first load it works acceptable. But if user changes the state (we use UI-Router) and goes back to the home page afterwards then...

Paste the elements of two columns [duplicate]

r,performance,data.frame,paste,rcpp
This question already has an answer here: Speedy/elegant way to unite many pairs of columns 3 answers I have a data.frame of the following kind set.seed(12) d = data.frame(a=sample(5,x=1:9), b=sample(5,x=1:9), c=sample(5,x=1:9), d=sample(5,x=1:9), e=sample(5,x=1:9), f=sample(5,x=1:9)) d # a b c d e f # 1 1 1 4 4 2...

ICorProfilerCallback2: CLR profiler does not log all Leave calls

c#,.net,windows,performance
I am trying to write a profiler that logs all .Net method calls in a process. The goal is to make it highly performant and keep let's say the last 5-10 minutes in memory (fixed buffer, cyclically overwrite old info) until the user triggers that info to be written to...

What is difference between join syntax in T-SQL [duplicate]

sql,sql-server,performance,tsql
This question already has an answer here: ANSI vs. non-ANSI SQL JOIN syntax 6 answers This is my SQL query: SELECT last_name, department_name FROM employees e, departments d WHERE e.department_id = d.department_id; And: SELECT last_name, department_name FROM employees e INNER JOIN departments d ON e.department_id = d.department_id; What is...

for loop vs for loop in reverse: performance

javascript,performance,for-loop
According to What's the Fastest Way to Code a Loop in JavaScript? and Why is to decrement the iterator toward 0 faster than incrementing , a basic for loop is slower than a for - loop with simplified test condition, i.e.: console.log("+++++++"); var until = 100000000; function func1() { console.time("basic")...

hadoop large file does not split

performance,hadoop,split,mapreduce
I have an input file of size 136MB and I launched some WordCount test and I monitor only one mapper. Then I set dfs.blocksize to 64MB in my hdfs-site.xml and I still get one mapper. Am I doing wrong ?

performance issues executing list of stored procedures

c#,multithreading,performance,loops
I'm having some performance issues when starting my windows service, the first round my lstSps is long (about 130 stored procedures). Is there anyway to speed this up (except for speeding the stored procedures up)? When the foreach is over and goes over to the second round it goes faster,...

Collatz and other sequences: how to get more precision easily and avoid segfault?

java,c,performance
Here's a simple C program I created from some old Java code (my first C program, so be nice ;) ). This runs much faster than the corresponding Java code, but Java allows me to be more precise (I'm using longs in Java, too) before it crashes. To my surprise,...

How do I update my Texview based on my selection

android,performance
I have a textview, 2 Checkboxes, 2 RadioButtons. What ever item I select or deselect should be updated on the textview - how do I achieve this ??? I know we can do it using an if else but what if the problem turns complex? For instance, what if I...

An efficient way to write this piece of code [closed]

c#,performance
How would a experienced programmer write this... SummonerPlatform = (SummonerRegion == Region.br) ? SummonerPlatform = Platform.BR1 : (SummonerRegion == Region.eune) ? SummonerPlatform = Platform.EUN1 : (SummonerRegion == Region.euw) ? SummonerPlatform = Platform.EUW1 : (SummonerRegion == Region.kr) ? SummonerPlatform = Platform.KR : (SummonerRegion == Region.lan) ? SummonerPlatform = Platform.LA1 : (SummonerRegion...

R: Painfully slow read performance using RODBC & SQL Server

sql-server,r,database,performance,rodbc
I am new to R but am interested in using Shiny to create dynamic charts using data stored in a SQL Server database. To enable interactivity, I want to bring in the raw data from the database and perform calculations within R rather than have the database summarize the data....

Overuse of NSView -> Alternatives?

objective-c,osx,performance,cocoa,nsview
I having some Performance troubles with my app: It takes more than 2 seconds to load -> So straight away I went to Apple documentation https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CocoaPerformance/Articles/CustomViews.html#//apple_ref/doc/uid/TP40001443-CJBJIFGC In the section named "Avoid the Overuse of Views" at the bottom I got very confused: I indeed adding a lot of NSViews (Guess...

Prevent upvote model from being called for every comment

ruby-on-rails,ruby,database,performance,model
I have three models: User, Comment and Upvote. User-to-Comment has a one-to-many relation, Comment-to-Upvote has a one-to-many relation and User-to-Upvote has a one-to-many relation. I want to do something similar to the upvoting done on Stackoverflow. So when you upvote/downvote the arrow will highlight and remain highlighted even if you...

Messaging table performance - Merge from and to id`s into one single field vs separate 2 fields

mysql,performance,database-design,relational-database,database-schema
What would be the implications on performance on merging the users id from the "messages" table in form of "fromto" - ex userID - 5, userID 9 => "59" versus having two separate columns "from" and "to"? Flow - list, read, delete messages when both id`s will be available in...

Universal function for getting all unique pairs, trebles etc from an array in javascript

javascript,jquery,arrays,performance,underscore.js
I am looking to create a function in javascript, which would allow me to pass a long array, together with one argument. what I'm looking for is something like this: var ar = [1,2,3,4]; var pairs = superAwesomeFunction(ar,2) //=> [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]; var trebles = superAwesomeFunction(ar,3) //=> [[1,2,3],[1,2,4],[1,3,4],[2,3,4] ideally, the function would...

SQL Server Query Performance with Timestamp and variable

sql-server,performance,timestamp
I have a simple SQL query to count the number of telemetry records by clients within the last 24 hours. With an index on TimeStamp, the following query runs in less than 1 seconds for about 10k rows select MachineName,count(Message) from Telemetry where TimeStamp between DATEADD(HOUR,-24, getutcdate()) and getutcdate() group...

Synchronize local SQLite database with central database

android,performance,sqlite,compare
We are developing an Android App based on a product that already has a website. As a result, when launching the Android app it may happen that a lot of things differ between the local SQLite database and our central database. What is the fastest way to synchronize the Android...

Why is the graph spiky when using average?

c#,.net,performance,performancecounter,performance-monitor
Im using messageInspectors in my WCF service to measure elapsed time on each service method like this : public void AfterCall(string operationName, object[] outputs, object returnValue, object correlationState) { if (_activated) { _startTime.Stop(); PerformanceCounterHandler.Instance.SetAveragePerformanceCounter(operationName, _startTime.ElapsedTicks); } } public object BeforeCall(string operationName, object[] inputs) { Guid correlationState; if (_activated) { correlationState...

Pygame 3D: How to and is it possible?

python,performance,dictionary,3d,pygame
So I want to program a 3d-mesh viewer in pygame, no other 3rd-party modules wanted (panda3d is perfect, but it's very complicated). My idea is: list_of_surfs = {'85 50':'70deg'} #the 85 50 and the dimensions of the #side/surf, and 70 deg of rotation to be able to see it, then...

Why Google Chrome warns that a function could not be optimized because of a ForIn loop? [closed]

javascript,performance
I have an enterprise javascript web application where I utilize the for-in loop a lot. When I profiled the application at a potential bottleneck, Chrome profiler gave me lots of exclamation mark icons next to function names, and alerted that those functions were not optimized due to ForIn loop. The...

Fast method to transform a string with about 150mb

c++,performance,c++11
I've been trying to decrease every single char value in a std::stringstream by 100: std::string str = stream.str(); auto decrement = [](char c) { return c - 100; }; std::string out; out.reserve(str.size()); std::transform(str.begin(), str.end(), std::back_inserter(out), decrement); stream = std::stringstream(out); But it took 7 minutes stuck on the std::transform instruction. That...

Clustering a large, very sparse, binary matrix in R

r,performance,matrix,cluster-analysis,sparse-matrix
I have a large, sparse binary matrix (roughly 39,000 x 14,000; most rows have only a single "1" entry). I'd like to cluster similar rows together, but my initial plan takes too long to complete: d <- dist(inputMatrix, method="binary") hc <- hclust(d, method="complete") The first step doesn't finish, so I'm...

Getting values from multi-dimensional array too slow

java,android,arrays,performance,sqlite
Good Day, I've been working on an update in an android project, and came across an issue. I have to read questions from an SQLite database which i've done successfully by loading it into a multi-dimensional array as shown below in my database helper class: public String getSome(int s,int t,...

Ruby: How does loading of objects in batches improve memory usage?

ruby-on-rails,ruby,performance
I'm self taught and not too sure about the terminology or specific improvements there are (if any) from splitting up object loading into separate parts in a loop. For example, I use rails and recently I've encountered an issue where I was loading too many heavy ActiveRecord objects at once,...

Android: Is this method always available and present?

android,performance,storage,android-file
I want to make the most out root access to all folders. this order is correct and always available and present? File ffile = new File(Environment.getRootDirectory().getParent()); // return "/" // "/" out root access to all folders ...

Parsing large XML file in R is very slow

xml,r,performance,xml-parsing,data.frame
I need to extract data from a large xml file in R. The file size is 60 MB. I use the following R code to download the data from the Internet: library(XML) library(httr) url = "http://hydro1.sci.gsfc.nasa.gov/daac-bin/his/1.0/NLDAS_NOAH_002.cgi" SOAPAction = "http://www.cuahsi.org/his/1.0/ws/GetSites" envelope = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"...

Does PostgreSQL quickly search for columns with arrays of strings?

arrays,database,performance,postgresql,indexing
According to Can PostgreSQL index array columns?, PostgreSQL can index array columns. Can it do searches on an array column as efficiently as it does for non array types? For example, suppose you have a row from a questions table (like SO): title: ... content:... tags: [ 'postgresql', 'indexing', 'arrays'...

Why is my browser freezing while doing a counting for child elements inside a container div using jQuery?

javascript,jquery,performance
I am using this jquery GanttView library to generate a Gantt Chart - https://github.com/thegrubbsian/jquery.ganttView After the Gantt has been generated, I am executing following jQuery code to count child elements inside the ganttchart generated html: $('.ganttview-grid').children().length But it is freezing the browser to about 40 seconds and there aren't really...

SQL execution time much slower in a Tomcat Servlet than in a normal Java program

java,performance,tomcat6,ojdbc
For inexplicable reasons however, this morning the performance increased for two of my Queries that used to be slow. I have no idea why. I have no authority over the server, maybe someone changed something. The problem is no more. In a nutshell: s.executeQuery(sql) runs extremely slowly within a tomcat...

Why does the java DirectoryStream perform so slow?

java,performance,stream,nio
I've done some testing with Streams in special with DirectoryStreams of the nio-package. I simply try to get a list of all files in a directory sorted by last modified date and size. The JavaDoc of old File.listFiles() stated a Note to the method in Files: Note that the Files...

Converting collection to array with no extra memory

java,arrays,performance,memory,collections
I need to convert Map into 2D array, so I've wrote this piece of code but it eats a lot of memory and I can't figure out why. private DataItem[][] convertDataToArrays(boolean[] filter, Map<Integer, List<T>> dataSet) double[] data = new double[sizeOfNewVector]; DataItem[][] reducedData = new DataItem[dataSet.size()][]; for (int i = dataSet.size()...

Javascript performance of indexing

javascript,performance
Is the following line considered unoptimal, especially considering it is being used in many places or inside of a loop: var age = myObject[index]["Person"]["Identity"]["Bio"]["Age"] ...

Sprite Kit render performance using 16x16 tiles vs 32x32 tiles?

ios,objective-c,performance,sprite-kit,tiled
I've made a Tiled game. Right now I'm stress testing my phone's capabilities by increasing amount of nodes in the scene. There's physics based stuff, AI movement, Day & Night system, particles popping out here & there & plenty of other stuff going on under the hood for my scenes....

How to improve nodejs / socket io performance?

javascript,node.js,performance,websocket,socket.io
I have set up a server for a little game. The clients send their movement data in a certain interval to the server. The server sends data about the other players, also in a certain interval, to the clients. If I add more players, the performance gets worse. How can...

Unsafe, reflection access vs toCharArray (performance)

java,performance
JDK9 team puts effort into helping us removing non-public dependencies (using jdeps). I am using Unsafe class for faster access to Strings inner char array - without creating new char array. If I want to drop dependency on Unsafe class, I would need to load it dynamically and call Unsafe.getObject...

Most efficient way to clone a list into an existing list, minimizing memory reallocation?

c#,performance,list,memory-management,clone
I have a need to clone an existing list into another, existing list. As the environment demands very high performance, I need to eliminate unnecessary memory reallocation. The most efficient algorithm I can think of is the following, which will increase the capacity of the destination list to match the...

Nesting flex box

css,performance,responsive-design,frontend,flexbox
I find flex box really useful, and since I discovered it I am tempted to use it everywhere. Question Is it a good practice to nest flex-boxes? Does having a lot of them and especially nested ones has an impact on performance?...

Fastest R equivalent to MATLAB's reshape() method?

r,performance,matlab,vectorization,reshape
I am converting a MATLAB script into R and regretting it so far, as it is slower at the moment. I'm trying to use "vectorized functions" as much as possible, but I'm relatively new to R and do not know what is meant by this. From my research for loops...

How to make this code more performant?

performance,go,hashmap
I have this snippet of code that iterate over a map and filter some fields based on relation type, I have to run two loops and have a feeling that it is going to be slow for big maps. Is there any way I can technique/refactoring to make this code...

Why in C++ overwritingis is slower than writing?

c++,performance,stack,heap-memory
I have to run a piece of code that manages a video stream from camera. I am trying to boost it, and I realized a weird C++ behaviour. (I have to admit I am realizing I do not know C++) The first piece of code run faster than the seconds,...

Should I pass all the state in every change from store to component?

javascript,performance,reactjs,reactjs-flux,flux
I am new on React and Flux and I am making an app that will have an input (like the name or the title), and below a list of n things. How should I handle the event listeners? I saw in the TODO example of flux (https://github.com/facebook/flux/blob/master/examples/flux-todomvc/) that they use...

Always assign vs check equality and assign

c++,performance
Is there any noticeable performance difference between: if (a != b) a = b; and a = b; when a and b are both of the same built-in type like int or bool or maybe a really simple and small struct? As I understand second expression will write to memory...

Numpy matrix row comparison

python,performance,numpy,matrix,comparison
The question is more focused on performance of calculation. I have 2 matrix with the same number of columns and different number of rows. One matrix is the 'pattern' whose rows have to be compared separately with the other matrix rows (all rows), then to be able to extract statistical...

select speed on indexed column mysql

mysql,sql,database,performance
I have a mysql table on innodb with 4.5ish million rows. Why is there a HUGE time difference between these (seemingly to me) almost identical select statement? url is varchar(200) select * from table where url = 12345; take 2.715 seconds select * from table where url = "12345"; takes...

Which View is best choice for android camera preview?

android,performance,android-camera,preview,android-textureview
As we know, we can choose TextureView, SurfaceView and GLSurfaceView for android camera preview. Which one is best choice for camera preview ? I'm focused on the camera performance. ...

MVC - Should I avoid to import more namespaces in view

asp.net-mvc,performance,razor,using-directives
I know some of you guys would consider it an unrelated question but, It's an important question for an MVC developer when you making it certain to make your application efficient and speedy. As you know that we can import a namespace into a view using 'using' clause. My question...

Mysql query using subselects needs to use joins or exists

mysql,sql,performance,join,subquery
NOTE If your going to downvote my question that I clearly put a lot of time into, can you please at least tell me why so I can avoid any mistakes in the future? Thank you. Update At the suggestion of @DRapp I am adding an explanation as to what...

How does hopscotch hashing actually work?

algorithm,performance,hash,hashtable,hopscotch-hashing
I am reading about hopscotch hashing The algorithm says when we run into colision during insert: Otherwise, j is too far from i. To create an empty entry closer to i, find an item y whose hash value lies between i and j, but within H − 1 of j,...

How fast can we make a specific tr?

c,performance,io
I had to replace all the null bytes in a file with another character (I arbitrarily chose @), and was pretty surprised that tr '\00' '@' was about 1/4 the speed of gzip: $ pv < lawl | gzip > /dev/null ^C13MiB 0:00:04 [28.5MiB/s] [====> ] 17% ETA 0:00:18 $...

In CodeIgniter, is there a performance disadvantage to loading unecessary libraries, helpers etc?

php,performance,codeigniter
In creating a log in process in CodeIgniter I have this for the __construct. public function __construct() { parent::__construct(); $this->load->library('session'); $this->load->helper('form'); $this->load->helper('url'); $this->load->helper('html'); $this->load->database(); $this->load->library('form_validation'); $this->load->model('login_model'); } The index method contains all the necessary code to handle the login. I am going to set up the log out process and...

Fast access to matrix as jagged array in C#

c#,performance,matrix,jagged-arrays
I've created a lower triangular distance matrix (because of size issues) as jagged array Note: Distances between objects are symmetric var dm = new double[size][] for (var i = 0; i < size; i++) { dm[i] = new double[i+1]; for (var j = 0; j < i+1; j++) { dm[i][j]...

Can not increase max_open_files for Mysql max-connections in Ubuntu 15

php,mysql,performance,ubuntu
I am running this version of Mysql Ver 14.14 Distrib 5.6.24, for debian-linux-gnu (x86_64) On this version of Ubuntu Distributor ID: Ubuntu Description: Ubuntu 15.04 Release: 15.04 Codename: vivid This is the config I set for Mysql: key_buffer_size = 16M max_allowed_packet = 16M thread_stack = 192K thread_cache_size = 8 innodb_buffer_pool_size=20G...

What would be the fastest way to insert this data

mysql,sql,database,performance,csv
Okay, so I have a MySQL table called entries which contains the columns name VARCHAR(255) NOT NULL and address VARCHAR(255) The table has about a million sets of data. For every set of data, name has a value e.g. "john" whilst address is NULL. For example: +------+---------+ | name |...

fast JQUERY SELECTOR for clicking

jquery,performance
Do I need to wrap class elements by an id element for a big document? Is $('#id').find('.class').click faster than $('.class').click ? Also, I want to know. Is <a onclick="function()">link</a> faster than selector id link with $(selector).click?...

Random sample of character vector, without elements prefixing one another

r,performance,combinatorics
Consider a character vector, pool, whose elements are (zero-padded) binary numbers with up to max_len digits. max_len <- 4 pool <- unlist(lapply(seq_len(max_len), function(x) do.call(paste0, expand.grid(rep(list(c('0', '1')), x))))) pool ## [1] "0" "1" "00" "10" "01" "11" "000" "100" "010" "110" ## [11] "001" "101" "011" "111" "0000" "1000" "0100" "1100"...

Java: 32-bit fp implementation of Math.sqrt()

java,performance,math,32-bit
The standard Math.sqrt() method seems pretty fast in Java already, but it has the inherent drawback that it is always going to involve 64-bit operations which does nothing but reduce speed when dealing with 32-bit float values. Is it possible to do better with a custom method that uses a...

How to print iterations per second?

python,performance,loops,cmd,progress
I have a small Python script which sends POST requests to a server and gets their response. It iterates 10000 times, and I managed to print the current progress in command prompt using: code=current_requestnumber print('{0}/{1}'.format(str(code),"10000"),end="\r") at the end of each loop. Because this involves interaction with a webserver, I would...

How to model data for in-memory processing

java,performance,design,architecture,data-modeling
I have a lot of static data (i.e. read only data, which is not transactional) which gets updated only once in few days. I have to support searches on that data (api calls, not sql). So I am thinking I will just load it in Memory, and refresh the in-memory...

MySQL - How can I know my query is tuned?

mysql,performance,explain
I'm creating a DB from scratch and I'm trying to create queries with performance in mind. For test purpose I filled my tables with test data. My query needs to join 3 tables: 2 with millions of rows and the third with hundred thousands rows. How can I know my...

MySQL JOIN / IN performance optimization

mysql,sql,performance
I have a following MySQL query: SELECT p.post_id, p.date_created, p.description, p.last_edited, p.link, p.link_description, p.link_image_url, p.link_title, p.total_comments, p.total_votes, p.type_id, p.user_id FROM posts p JOIN posts_to_tribes ptt ON p.post_id=ptt.post_id WHERE ptt.tribe_id IN (1, 2, 3, 4, 5) GROUP BY p.post_id ORDER BY p.last_edited DESC, p.total_votes DESC LIMIT 25 In a non-concurrent environment...

Reading from DATA file handle

performance,perl
My perl module needs to use a look up table that's about 309,000 lines long. Currently the part that loads the table into an array looks (roughly) like this: use strict; use warnings; # load all the data from below my @ref_data; while (<DATA>) { push @ref_data, $_ } close...

C/C++: What's faster: a for loop, or incrementing a pointer

c++,c,performance,loops,pointers
I am wondering which of the following code segments would be fastest, assuming that the goal is to read from the elements of type T in amount numElements pointed to by somePointer and do something with them. I'm specifically interested in the efficiency of the looping structure itself, not what's...

microtime(true) - Trouble measuring PHP script execution time

php,performance
While trying to compare algorithm running time in PHP, I came across the microtime() function. But I think there's something fundamental I've missed in understanding. The difference of two microtime(true) calls returns the result in seconds, right? Then consider this extremely simple script: $t1 = microtime(true); //do nothing $t2 =...

performance of executing openjpa query

java,performance,jpa,openjpa
I have a rest web app with cxf 3.0.1 framework and openjpa 2.3.0. The web.xml: <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <display-name>Mobile app rest services</display-name> <context-param> <param-name>contextConfigLocation</param-name> <param-value>WEB-INF/cxf-servlet.xml</param-value>...

Alpha blending using table lookup is not as fast as expected

c,performance,optimization,alphablending,lookup-tables
I thought memory access would be faster than the multiplication and division (although compiler-optimized) done with alpha blending. But it wasn't as fast as expected. The 16 megabytes used for the table is not an issue in this case. But it is a problem if table lookup could even be...

Meteor: How can I show questions only asked by users with the field 'active'

performance,mongodb,meteor
I am building a quora of sorts.. and I am trying to clean up my website. Currently if a user deletes their profile, their question remains there and will display no user. I am trying to link it up users. What I did was I added a field on the...

(Automatically) convert SQL strings to 'enums'?

sql,performance,postgresql
We have a PostgreSQL database with billions of entries in the form: CREATE TABLE entry ( session integer NOT NULL, time integer NOT NULL, key text NOT NULL, data text NOT NULL ) In this database key is a developer-defined string, while data is user-defined content. In other words, while...

Dynamic creation of objects vs storing them as fields

java,performance,object
I have this loop which runs about 1,000,000 times. while ((line = br.readLine()) != null) { if(!(line.isEmpty())){ data = new JSONObject(line); name = (String)data.get("name"); surname = (String)data.get("surname"); ar.put(name, surname); //an array } } What are the advantages (if any) in terms of efficiency of having it like that were data,name...

Fastest way to draw sprites in opengles 2.0 on android

android,performance,opengl-es,opengl-es-2.0
So Im trying to figure out how to draw a single textured quad many times. My issue is that since these are create and deleted and every one of them has a unique position and rotation. Im not sure a vbo is the best solution as I've heard modifying buffers...

How do we improve a MongoDB MapReduce function that takes too long to retrieve data and gives out of memory errors?

performance,mongodb,delphi,mapreduce
Retrieving data from mongo takes too long, even for small datasets. For bigger datasets we get out of memory errors of the javascript engine. We've tried several schema designs and several ways to retrieve data. How do we optimize mongoDB/mapReduce function/MongoWire to retrieve more data quicker? We're not very experienced...

Ontologies, OWL, Sparql: Modelling that “something is not there” and performance considerations

performance,sparql,modeling,ontology,sesame
we want to model that "something is not there" as opposed to missing information, e.g. an explicit statement that "a patient did not get chemotherapy" or that "a patient does not have dyspnea" is different from missing information about whether a patient has dyspnea. We thought about several approaches, e.g....

Why is R (in my example) very slow for handling dates/datetimes?

r,performance,date,datetime
I have a list of 40 dataframes with about 250k rows and I want to append a new variable to each dataframes. This new variable period is calculated from another variable which contains Date objects, the transformation is very simple, if the year part of the date is lower than...

Compare multi values against multi values, maintaining performance

c#,performance,linq,tsql,database-performance
I have two forms of records or data. One being Inventory Record and the other a Product. Both the Inventory Record and Product Record have Code values stored in separate tables. Each record has a value record and is foreign keyed to the main table. I am trying NOT to...

Speeding up a SQL query with indexes

sql-server,database,performance
I have a table called Products. This table contains over 3 million entries. Every day there are approximately 5000 new entries. which only happens during the night in 2 minutes. But this table gets queried every night maybe over 20 000 times with this query. SELECT Price FROM Products WHERE...

DB Index not being called

oracle,performance,oracle11g,oracle10g,database-performance
I know this question has been asked more than once here. But I am not able to resolve my issue so posting it again for help. I have a table called Transaction in Oracle database (11g) with 2.7 million records. There is a not-null varchar2(20) (txn_id) column which contains numeric...

Performance difference between pattern matching and if-else

performance,pattern-matching,ocaml
Why can OCaml generate efficient machine code for pattern matching and not for if-else tests? I was reading Real World OCaml and I came across this section where they compared the performance of pattern matching to the performance of if-else tests. It turned out that pattern matching in their example...

Best data type for list of ?

c#,performance
What's the best data type performance-wise for a list of tuples composed of <ID, object>, such that the IDs are not unique? For example: 1 tire 1 rim 1 spoke 2 buckle 2 flap 2 bag What would give the best performance when selecting for ID = 1? I have...

Java infinite loop performance

java,multithreading,performance,infinite-loop
I have a Thread that only has to work when a certain circumstance comes in. Otherwise it just iterates over an empty infinite loop: public void run() { while(true) { if(ball != null) { // do some Calculations } } } Does it affect the performance when the loop actually...

In JavaScript, is there any difference between typeof x == 'y' and typeof x === 'y'?

javascript,performance,comparison,undefined,typeof
I'm aware of the difference between strict and loose comparison operators. Clearly x == y is different from x === y. But whenever I see code that uses typeof, it always uses ===. If the typeof operator always evaluates to a string (such as 'boolean', 'number', etc.), then wouldn't typeof...

How to count the number of zero decimals in javascript?

javascript,performance
How do I get the number of zero decimals behind the comma (but not the total)? So to illustrate an example: 0.00001 > 4 0.000015 > 4 0.0000105 > 4 0.001 > 2 I am looking for methods that are efficient (meaning that they optimize the calculation time)....

Timing cliente side and server side time of a request in ASPX?

javascript,asp.net,performance,code-timing
There is an request at my web application that takes a longer time, but I don't know if it is a server side problem or client side problem. Is there an way to timing client side process and server side process of a request in ASPX?

What is faster: equal check or sign check

java,performance,comparison,equality,cpu-architecture
I wonder which operation works faster: int c = version1.compareTo(version2); This one if (c == 1) or this if (c > 0) Does sign comparasion use just a one bit check and equality comparasion use substraction, or it is not true? For certainty, let's say we work on x86. P.S....

How to improve speed for time limit exceeded

c++,c,performance
Is there any way to improve the running time for this program? I get time limit exceed error from the online judge, and it seems like my program is running slow? So, this is the question for this program: http://www.spoj.com/problems/PRIME1/ My code (language c): #include <stdio.h> void FindPrime (int m,...

How to increase the performance for estimating `Pi`in Python

python,performance,pi
I have written the following code in Python, in order to estimate the value of Pi. It is called Monte Carlo method. Obviously by increasing the number of samples the code becomes slower and I assume that the slowest part of the code is in the sampling part. How can...

Need to print function's actual parameter name used while calling

java,performance,swing,reflection
I want to print function actual parameter name in function. For reference please refer below code.Here i am trying reflection. class Refrction { public static int a=12; public static int b=12; public static int c=13; public void click(int x) { Class cls=Refrction.class; Field[] fields = cls.getFields(); //here i want to...

Using backface-visibility on * elements

css,performance,css3,webkit
I was doing some work on a website with a fixed sidenav that scrolls with the page. Now I noticed that there are some problems with position: fixed elements in the webkit rendering engine (see this) and to solve those - as seen in the post, I used -webkit-backface-visibility: hidden;....

Do you get the same performance using index prefixes?

performance,mongodb,indexing
Say I have a collection containing documents like the one below: { _id: ObjectId(), myValue: 123, otherValue: 456 } I then create like below: {myValue: 1, otherValue: 1} If I execute the following query: db.myCollection.find({myValue: 123}) will I get the same performance with my index as I would if I...

Performance degradation of fast-serialization

java,performance,serialization
This question is particular to the Fast-Serialization library. https://github.com/RuedigerMoeller/fast-serialization I am using FSTLongOffheapMap (version 2.29) on windows 7, jdk 1.7 to store some objects. I tested the latency of storing an object and the 99.99 percentile comes to about 100 micros. This is excellent considering I ran it on windows...

Java: Is there any real performance cost for passing object references between looped methods

java,performance,game-loop
Scenario 1: public class Game { public void doSomething(Hero hero, Enemy enemy){ if (hero.IsAlive()){ hero.checkCollisionWith(enemy); } } } Scenario 2 public class Game { Hero hero; Enemy enemy; public Game(Hero hero, Enemy enemy) { this.hero = hero; this.enemy = enemy; } public void doSomething() { if (hero.IsAlive()){ hero.checkCollisionWith(enemy); } }...

Unwanted animation of the NavDrawer when getting back to previous Activity

android,performance,navigation,navigation-drawer
I have a Navigation Drawer that launches activities when items are selected. Here's the problem: when I press back from an Activity, i get back to the previous Activity, but unfortunately i see an animation of the Navigation Drawer closing. This is an unwanted behaviour: i want to get back...

Load js files from the web or serve them yourself?

javascript,performance,latency
I have had this question for awhile and am surprised that I have yet to come across a good/complete answer to it. The question is essentially this: When it comes to loading js files, in what situations should you load them from the web if available versus serving them up...

MySQL COUNT vs SELECT rows performance

php,mysql,performance,count
I have a small table with three columns and using PHP. TABLE (id unsigned int(10), gameid unsigned int(10), userid unsigned int(10)) - id, gameid and userid are indexed. At some point (When a player join a game) system will check if the game already have 100 players in it, if...

OpenCV FAST corner detection SSE implementation walkthrough

c,performance,opencv,optimization,sse
Could someone help me understanding the SSE implementation of the FAST corner detection in OpenCV? I understand the algorithm but not the implementation. Could somebody walk me through the code? The code is long, so thank you in advance. I am using OpenCV 2.4.11 and the code goes like this:...

Does java cache array length calculation in loops [duplicate]

java,arrays,performance,compiler-optimization
This question already has an answer here: What is the Cost of Calling array.length 9 answers Lets say that i have an array which i would like to iterate over: int[] someArray = {1,2,3,4} for (int i = 0; i < someArray.length; i++) { // do stuff } Will...

Insert multiple rows into MySQL table

java,mysql,sql,performance
I have a table as follows: CREATE TABLE IF NOT EXISTS mytable ( `id` INT(22) NOT NULL AUTO_INCREMENT, `name` VARCHAR(255) NOT NULL, `uuid` VARCHAR(255) NOT NULL, `x` INT(11) NOT NULL, `y` INT(11) NOT NULL, `z` INT(11) NOT NULL, `time` BIGINT NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY idx_table_x_y_z ( x,...

How does a servlet handle more bytes than available RAM?

java,performance,servlets,jvm
Lets say that I have a servlet running that accepts files of any size from a client application(s). The file being sent is loaded into a DataHandler and is transmitted by web-services; as such is received and put back into a DataHandler. What happens if the file being sent exceeds...

I can't push items into jasvacript array quick enough

javascript,jquery,arrays,performance,jquery-ui
I have a jQuery UI slider that when a user triggers a slide function, I need to push the current slide value into an array. The problem is, when a user slides the handle too quickly, the length of the array and the current index value fall out of sync....

Slow performance from rake task - How to streamline these Rails queries

ruby-on-rails,ruby,performance
I am experiencing slow performance on a rake task. Upon review, it looks like the same item is being queried 3 times. Is there a way to simplify this so only one query is executed? Would this have a significant performance improvement? Would love to hear your ideas. Here's a...

parallelizing matrix multiplication through threading and SIMD

c,multithreading,performance,matrix-multiplication,simd
I am trying to speed up matrix multiplication on multicore architecture. For this end, I try to use threads and SIMD at the same time. But my results are not good. I test speed up over sequential matrix multiplication: void sequentialMatMul(void* params) { cout << "SequentialMatMul started."; int i, j,...