w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Haskell performance: Struggling with utilizing profiling results and basic tuning techniques (eliminating explicit recursion, etc.)
The timings of your programs have very little to do with the languages' performance, and everything with terminal IO. Remove the printing of each step (BTW, putStrLn . show ≡≡ print) from your Haskell program, and you'll get $ time RK-hs 1.0 real 0m0.004s user 0m0.000s sys 0m0.000s ... which isn't really significant, though – 1000 steps is far to little. With main :: IO () main = do let y' t y = -y h = 1e-7 y0 = 1.0 t0 = 0 results = iterateRK y' h t0 y0 print . head $ drop 10000000 results you get $ time RK-hs +RTS -K100M 0.36787944117145965 real 0m0.653s user 0m0.572s sys 0m0.076s while the equivalent in C has $ time RK-c Segmentation fault (core dumped) oh great... ...but as you see, I

Categories : Performance

Query taking to long tuning advice please
Try something like this - DECLARE @Responses TABLE (responseHeaderID INT, questionID INT, answerItemsID INT) DECLARE @ResponseHeader TABLE (id INT, YOS INT, rankID INT, unitID INT, age INT, gender CHAR(1), completed BIT) SELECT * FROM ( SELECT DISTINCT rh.id , rh.YOS , rh.rankID , rh.unitID , rh.age , rh.gender FROM @ResponseHeader rh WHERE completed = 1 ) rh LEFT JOIN ( SELECT * FROM ( SELECT r.responseHeaderID , r.questionID , r.answerItemsID FROM @Responses r ) t PIVOT ( MAX(answerItemsID) FOR questionID IN ([42], [43], [44], [48], [50], [49]) ) p ) t2 ON rh.id = t2.responseHeaderID ORDER BY rh.id Output -

Categories : SQL

Tuning Neo4j for Performance
Okay, so first of all, for only 8GB of memory that's a very large graph. You should seriously consider getting a larger box. Neo4j actually provides an extremely nice hardware calculator that will let you determine exactly what is appropriate for your needs: http://neotechnology.com/calculatorv2/ In a contrived way (since there are more relevant metrics to determining size) their calculator estimates should should be dedicating about 10GB at a minimum. Secondly, Neo4j and any graph database will have issues with nodes that have a large number of connections. If you're looking to tune your instance to perform better (after getting a bigger box) I would suggest looking for any massive nodes with a large number of connections as those will seriously impact performance. After seeing your

Categories : Neo4j

Performance tuning in F# scripts / F# interactive
In a typical Java program I'd just fire up a profiler (jvisualvm, for instance) and have it tell me which were the hot methods in some kind of CPU Sampling view. I guess this would work exactly the same way were I developing with .fs files in a regular project. As I'm in F# Interactive I'm a bit lost. Using fsx files and F# Interactive doesn't mean that you should abandon compiling projects completely. I would change Build Action in File Properties to Compile in order to compile fsx files directly. We need to use conditional compilation at some places e.g. #if INTERACTIVE #time "on";; #endif The advantages of compiling the code are: You can use Visual Studio profilers to get statistics about hot spots in programs. You can decompile programs using ILSpy. Sometimes ILs or even equi

Categories : Dotnet

Performance tuning for extractvalue in oracle 10g
Setting up a table like yours: CREATE TABLE TB_XML_TYPE(XML_DATA XMLTYPE); INSERT INTO TB_XML_TYPE(XML_DATA) VALUES (XMLTYPE('<a><Name>name1</Name><Name>name2</Name></a>')); I am guessing the Name element is right under the root element in your XML. If that's the case, this may be faster. SELECT XD.NAME FROM TB_XML_TYPE XT, XMLTABLE('/a/Name' PASSING XT.XML_DATA COLUMNS NAME VARCHAR2(100) PATH 'text()') XD Result: NAME --------------------- name1 name2

Categories : SQL

performance tuning where cpu not pinned and plenty of memory
My first guess would be either disk IO or mutexes. For disk, Try adding physical disk, read bytes/sec and write bytes/sec and also read/sec write/sec (ie both total bytes and actual io operation counts for read and write) Make sure they aren't spiking. Could also add queue length if you are keen. You are looking for big shifts like 10Mb/sec or lots of small IOs. For mutexs, which might be a side effect of memory allocation (very frequent memory allocation can cause this), try adding "system" and context switches/sec and maybe system calls/sec. These bounce a bit from general load, so get a feel first and then see what happens. If you think it is caused by memory bandwidth (ie exhausting the FSB) then I don't think perfmon can measure that, you would need to switch to something more

Categories : Performance

neo4j query performance tuning with node(*)
You're basically telling it to scan the entire DB for venue nodes (a good optimization would be to have an index for nodetype or just venue nodes, and scan that), and then traversing all venue's addresses/cities/etc., and then comparing those addresses to the search string. Your limit isn't going to help your performance much, and it's going to stink unless you have a very small db. How many venues do you have? In any case, you might consider something like this: start venue=node:venue_index('name:*QUERY_STRING*') match address<-[:HAS_ADDRESS-venue-[:IN_REGION]->city-[?:IN_REGION]->prov-[?:IN_REGION]->country return venue.name + ',' + address.streetAddress + ',' + city.name + ',' + coalesce(prov.name?, '') + ',' + coalesce(country.name?, '') as toSearch start city=node:city_i

Categories : Neo4j

Forcing Renderscript to run on CPU or GPU (Atleast for performance tuning purposes)
adb shell setprop debug.rs.default-CPU-driver 1 This will force execution to run on the reference CPU implementation. There is no equivalent to force things to the GPU as many conditions could make that impossible at runtime. Also useful is: adb shell setprop debug.rs.max-threads 1 Which limits the number of CPU cores to be used to 1 (or any other value you set up to the CPU count of the device)

Categories : Android

Basic SQL user trying to understand advanced SUM functionality
select sum(area),continent from world group by continent The grouping create groups of records based on the group by field, then the sum function sums up the total of the group.

Categories : SQL

How to handle basic, advanced, add on, and pro feature in Saas based software?
AFAIK, you should be handling these internally in your application so that the features like notification, workflow are marked as application features and for each tenant, there will be a mapping between the tenant id and the feature so that the tenant has access only to the features that he is subscribed to. So, when a tenant or his user logs in to the system, we identify the features and the contents that he can access and then show them to the user. This is called as a tenant licensing system. Also, whenever a feature is consumed, your code should be recording the tenant that consumed that feature and by how much and when and there can be cost associated with units of usage measurements. For more detailed discussion, please refer here Though these are all explained in C#, there shou

Categories : Spring

Entity Framework (6) Performance Optimisation advice
Selects are slow with tracking on. You should definitely turn off tracking and measure again. Take a look at my benchmarks http://netpl.blogspot.com/2013/05/yet-another-orm-micro-benchmark-part-23_15.html

Categories : C#

How to improve my query performance by indexing
I would combine these indexes into one index, instead of having three separate indexes. For example: CREATE INDEX ix_cols ON dbo.Table1 (Col1, Col2, Description) If this combination of columns is unique within the table, then you should add the UNIQUE keyword to make the index unique. This is for performance reasons, but, also, more importantly, to enforce uniqueness. It may also be created as a primary key if that is appropriate. Placing all of the columns into one index will give better performance because it will not be necessary for SQL Server to use multiple passes to find the row you are seeking.

Categories : Sql Server

The difference between Legacy Indexing/Auto Indexing and the new indexing approach in Neo4j
Yes, auto-indexes are a type of legacy index. Yes. Yes, you can for embedded. See an example here: Neo4j Embedded Fulltext Automatic Node Index The new "schema indexes" are the favored way to define indexes, based on labels. Legacy indexes are... the old way to do it. You can use them both together if needed.

Categories : Java

Tuning Java 7 to match performance of Java 6
This is not an easy answer, there are plenty of things that can account for those 2 seconds. I am assuming for your comments that you are already familiar with micro benchmarking and that your benchmark is being run after warming up the JVM having your code reach an optimized JIT state and no GCs happening, also assuming that your hardware setup has not changed. I would recommend CPU profiling your benchmark, that will help you identify where those two seconds are being accounted and perhaps act accordingly. If you are curious about the bytecode you can take a peek at it. To do this you can compile your class and do javap -c ClassName on both machines, this will disassemble the class file bytecode and show it to you, here you will surely see changes between both compiled classes. In c

Categories : Java

Solr performance tweaking for faster query / indexing, rather than the storage requirements
Indexing side: You could potentially increase the speed of indexing by using very high mergeFactors. Thus there will be very many Lucene index segments that will merge at slow speed (basically, merging is what takes quite a lot of time). Then by the time you are done with indexing, set the mergeFactor back to something sensible, like 10. This will make sure you have only few segments to read through. Also consider SSDs, some folks have reported better perf with these. Querying side: It is nearly impossible to recommend anything without knowing your particalur setup and use case. But monitor the cache usage. If you have high utilization rate of a particular cache, yet evictions, get rid of them by giving more RAM.

Categories : Solr

Basic Insert / Update Performance Issue
Based on the huge number of rows in your table and rows should be added/modified regularly in those tables. I'd suggest to execute following query first and see the execution time for the queries you have mentioned: analyze table page_views; analyze table test_table; Above commands will not take much time, should be executed with 5/10 secs. If you can afford little longer maintenance time(depends on the size of table): optimize table page_views; optimize table test_table; If you see performance gain, I also would like to inform that you can configure cron job which executes analyze daily and optimize weekly/monthly.

Categories : Mysql

Indexing and performance Implications of moving small table into big table
Perhaps look at using a partial index. From docs A partial index is an index built over a subset of a table; the subset is defined by a conditional expression (called the predicate of the partial index). The index contains entries for only those table rows that satisfy the predicate. A major motivation for partial indexes is to avoid indexing common values. Since a query searching for a common value (one that accounts for more than a few percent of all the table rows) will not use the index anyway, there is no point in keeping those rows in the index at all. This reduces the size of the index, which will speed up queries that do use the index. It will also speed up many table update operations because the index does not need to be updated in all cases. Example

Categories : SQL

Neo4j 2.0: Indexing array-valued properties with schema indexing
Schema indexes can only do exact matches right now. Your "testid" in n.sourceIds does not use the index (as shown by your query times). I think there are plans to make this behave better, but I'm waiting for them just as eagerly as you are. I've actually hit a lower max in the lucene query: 512. If there is a way to increase it I'd love to hear of it. The way I got around it is just doing more than one query if I have one of the rare cases that actually goes over 512 ids. What query are you doing where you need more?

Categories : Neo4j

Tuning SQL Select
Make sure you have indices on the columns ID_SMP,ID_CLIENTE,ID_TRANSPORTATOR in their various tables. This will make the joining operations much faster. And then, to finish it off you can try indexing the columns STATUS, RAZAO and DTINICIOPREV in the WHEREclause too.

Categories : SQL

Tuning query in SQL Server
Instead of using embeded queries into embeded queries... You could duplicate the logic you use to find your FromDate and change it to get your EndDate. This is way easier on the optimizer (consult the execution plan to see the difference). ; With LowerDateRange as ( Select Col1 ,Col2 ,Row_Number() Over (Order by Col1,Col2,fromDate, types) as RowId ,FromDate ,Types From Test R Where Not Exists ( Select Col1,Col2,FromDate From Test R1 where R1.FromDate = Dateadd(Day, -1, R.FromDate) And R1.Col1=R.Col1 And R1.Col2=R.Col2 And R1.Types=R.Types ) ) , UpperDateRa

Categories : Sql Server

Sql tuning using table and view
I'd make sure that the following are indexed: shipment.shipment_gid shipment_s_equipment_join.s_equipment_gid s_equipment_s_ship_unit_join.s_ship_unit_gid s_ship_unit_line.order_release_gid The NOT IN might work better as a NOT EXISTS.

Categories : SQL

Oracle Query/SQL tuning
I would suggest adding index on project_id will greatly reduce the execution time. If you dont want to add index to the base table, copy the o/p to a temp table, create index on the temp table and then fire the distinct query, I bet will be faster than 15 sec.

Categories : SQL

Oracle Query SQL Tuning?
First of all I would try with ordinary table joins instead of the more awkward inline view - joining, I hope the following will work (I haven't created tables and tried it): select round(avg(okuma.et_gsm_sınyal)) as sinyal, bilgiler.mahalle_kodu,bilgiler.ilce_kodu, SUBSTR(okuma.et_operator,1,5) as sebeke from thkol316old okuma inner join commt020 bilgiler on okuma.sozlesme_no=bilgiler.sozlesme_no where okuma.tarih >= ADD_MONTHS (TRUNC (SYSDATE, 'MM'), -1) AND okuma.tarih < TRUNC(SYSDATE, 'MM') group by bilgiler.mahalle_kodu,bilgiler.ilce_kodu, SUBSTR(okuma.et_operator,1,5); Then, if things still are slow: Verify that there is an index where bilgiler.sozlesme_no is the first column in the index Verify that there is an index where okuma.sozlesme_no is the first column in the in

Categories : SQL

CSS: fine tuning font size
Use font-size: 10.5px; Other options can be found here at w3: http://www.w3schools.com/css/css_font.asp You can use em as your unit, or specify as a %

Categories : CSS

After tuning Postgresql, PgBench results are worse
What is mean "worse"? How long time you run pgbench? This test should be executed about 2hour as minimum for realistic values. What version of PostgreSQL do you have? Attention: You should be very careful about interpretation pgbench result. Probably you should to optimize execution of your application, not pgbench. pgbench is good for hw or sw checking, is bad tool for optimizing of PostgreSQL configuration. A mentioned configuration variables are basic for configuration and you probably cannot to be wrong there (server must not use a swap actively ever - and these variables ensure it). A formula that I use: -- Dedicated server 8GB RAM shared_buffers = 1/3 .. 1/4 dedicated RAM effecttive_cache_size = 2/3 dedicated RAM maintenance_work_mem > higher than the most big table (if poss

Categories : Postgresql

basic javascript object and mime regarding a basic web-server code
Expanding on Jared's comments above. Using the single quotes in both the HttpServlet constructor and the MimeMap initializer is likely just the original authors style preference. There are times when this is necessary. For example when using a name that isn't a valid per the syntax rules or is a reserved javascript keyword. From A Survey of the JavaScript Programming Language: In the object literal notation, an object description is a set of comma-separated name/value pairs inside curly braces. The names can be identifiers or strings followed by a colon. Because of an error in the language definition, reserved words cannot be used in the identifier form, but they can be used in the string form. For example: { 'my name here': 'bob', '0': '', 'ne

Categories : Javascript

SQL Server Tuning Advisor - Statement does not reference any tables
Database Engine Tuning Advisor parses events in supplied workload and tunes the statements that are associated with the event. Events that cannot be tuned produce messages which are written to tuning log but this don't stop a tuning session. Tuning Advisor can tune an event only if a Showplan output is produced by the server for that event, in the database where the event was executed.There can be many reasons why events are not tuned as explained in article: http://technet.microsoft.com/en-us/library/ms179380(v=sql.100).aspx Tuning log message: S001 - Statement does not reference any tables and S008 - Event does not reference any tables are such an example. These are event-level messages, so the Statement column of the tuning log for them is empty.

Categories : Sql Server

Java Virtual Machine Heap Tuning Parameters
For clarity I would recommend you always define ms and mx (unless the defaults are sufficient). I think the result may differ depending on the JVM, but I believe Oracle's will throw an error if -Xms exceeds the default -Xmx setting. As far as heap fragmentation, I think that depends on the app and tuning of the JVM. It will vary depending on the JVM you're using, what garbage collector you're using, etc.

Categories : Java

GC pause tuning of long FIFO queue application
I'd try replacing the monstrous linked list with an ArrayDequeue, especially since the queue size is constant. An extremely long linked list is liable to lead to performance issues for a garbage collector that implements marking recursively. The collector is likely to be happier with a large array that can be marked iteratively. UPDATE There is one obscure GC tuning parameter that might help: CMSMarkStackSizeMax - Max size of CMS marking stack, defaults to 4M. If you made this parameter much bigger, it might be sufficient to stop the CMS collector from flipping into non-incremental mode if marking is deeply recursive (as it is likely to be for a monstrous linked-list.) However, doing that is going to increase your JVM's overall memory usage. My "back of the envelope" thinking is

Categories : Java

Tuning node-mongodb-native connection pool size
In scenarios like this, the first step is always to start to with the DB. If you have queries that are slow to respond, those queries should appear in the slow logs. Take a look at the official docs for profiling. The default value for "slow" queries is about 100ms, so if your slow queries are because of the DB, you will see evidence there. Additionally, take a look at the graphs for the DB. By "the graphs", I mean your Nagios/Cacti/Zabbix/ServerDensity/MMS charts of what the server is doing. If you do not have these, start there. Tweaking the connection pool size is useless if you don't actually know how many connections you have or what your CPU looks like. Any good tools or strategies to confirm or rule out the driver connection pool size as a bottleneck? Once you have ruled out

Categories : Node Js

Best tuning practices, experiences with Puma + Heroku + Rails 4 + Ruby 2.0
I have stack rails 3 + capistrano + unicorn + ruby 1.9.1 on the project with 150-200k page views per day. I can advice you install 'newrelic' to your VPS to monitor bottlenecks of your application. Digitalocean is nice, but they didn't serve droplets with big amount of memory and cores at Amsterdam datacenter in the moment when we choose hosting. So we used hetzner dedicated servers with SSD and lower price at higher performance.

Categories : Ruby On Rails

Basic delay command for Visual Basic
Since sleeping and busy waiting are generally frowned upon, you could do something with an AutoResetEvent: Private ReadOnly _resetEvent As AutoResetEvent = New AutoResetEvent(False) Sub Pause(ByVal milliseconds As Long) Dim waitInterval As TimeSpan = TimeSpan.FromMilliseconds(milliseconds) While Not _resetEvent.WaitOne(waitInterval) ' Waiting! End While End Sub This is not recommended, but here's an example using the System.Diagnostics.Stopwatch class: Sub Pause(ByVal milliseconds As Long) If milliseconds <= 0 Then Return Dim sw As New Stopwatch() sw.Start() Dim i As Long = 0 Do If i Mod 50000 = 0 Then ' Check the timer every 50,000th iteration sw.Stop() If sw.ElapsedMilliseconds >= milliseconds Then

Categories : Vb.Net

Getting weblogic.kernel.Default (self-tuning)'" java.lang.OutOfMemoryError:getNewTla exception. How to resolve this?
Try changing the TLA size with the arguments -XXtlasize:min=8k,preferred=128k. This blog post was helpful https://blogs.oracle.com/pa/entry/error_java_lang_outofmemoryerror_getnewtla

Categories : Performance

Clojure performance - why does the "ugly" "array swap trick" improve lcs performance?
As Chas mentions, loops with primitive hints are problematic. Clojure attempts to keep ints unboxed when you provide a hint, but it will (for the most part) silently fail when it can't honor the hints. Therefore he is forcing it to happen by creating a deftype with mutable fields and setting those inside the loop. It's a ugly hack, but gets around a few limitations in the compiler.

Categories : Arrays

C++: design advice
First advice is not to use protected atributes. Is is breaking incapsulation. The second advice is to make virtual void f()=0 pure virtual without implementation. In such there will be no error in the derived class.

Categories : C++

asp.net cache advice
But.. how you can do it for a single row of the table.. In ASP.Net you can create SQl Server dependency which uses a broker Service.. and puts the data into the cache and whenever the table is updated.. the cache will be rejected and new data is taken from db and put into the cache.. i Hope this might give you some idea!

Categories : Asp Net

Set a variable from an AOP advice
I don't know if it's the right way to do it, so feel free to comment. I created an interface Authed and its implementation AuthedImpl. public interface Authed { void setOwner(Owner owner); } Then I made RealEstatePropertyV1 extends from AuthedImpl. I added a pointcut for all classes extending from AuthedImpl and also changed the pointcut so I can access to the target. @Pointcut("execution(* *..AuthedImpl+.*(..))") public void extendsAuthedImpl() { } @Pointcut("execution(* *.*(.., com.google.appengine.api.users.User)) && args(.., user) && target(callee)") public void allMethodsWithUserParameter(User user, Authed callee) { } Finally the advice uses all pointcuts: @Before("annotatedWithApiMethod() && allMethodsWithUserParameter(user, callee) && exte

Categories : Misc

Advice on using GitHub
Your idea works fine, it sounds like you are just inexperienced with git. There are many tutorials available online, it takes a little getting used to. The issue you may be encountering is a git pull will bark at you if you have uncommitted changes locally when trying to pull. Make sure you have a clean, committed state when you pull and it'll work. Also, if you have committed but un-pushed changes, a pull will try to merge those changes, since that's what you asked it to do. Often this won't really be a problem, but conflicts can happen, and you'll need to resolve them when it does. This is just a normal occurrence with version control and something you should get used to dealing with.

Categories : GIT

Advice on CSS Positioning
I'd try to give some width to my divs. If your entire page is 800 px then; .page{your stuff} .top-div{width:800px; float:left; margin:0 auto;} .logo{float:left; width:200px;margin:0 auto;} .toparea{float:left; width:600px; margin:0 auto; } .sidebar{float:left; width:200px; margin:0 auto;} .mainpart{float:left; width:600px; margin:0 auto;} .bottompart{float:left; width:800px; margin:0 auto;} Imagine css as lego. if you put something on your 4 block size logo, it should stay there perfectly, if not check the size or your alignments. edit: this is not a solution, just a hint to give you idea about what to do.

Categories : CSS

vimeo advanced api for iOS
These are linker errors -- it's finding the headers just fine, but the library is missing at link time. Make sure the OA library is in the Linked Frameworks and Libraries list for your target.

Categories : IOS



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.