Search Results

Search found 3828 results on 154 pages for 'mathematical optimization'.

Page 74/154 | < Previous Page | 70 71 72 73 74 75 76 77 78 79 80 81  | Next Page >

  • How to optimize method's that track metrics in 3rd party application?

    - by WulfgarPro
    Hi, I have two listboxes that keep updated lists of various objects roaming in a 3rd party application. When a user selects an object from a listbox, an event handler is fired, calling a method that gathers various metrics belonging to that object from the 3rd party application for displaying in a set of textboxes. This is slow! I am not sure how to optimize this functionality to facilitate greater speeds.. private void lsbUavs_SelectedIndexChanged(object sender, EventArgs e) { if (_ourSelectedUavFromListBox != null) { UtilStkScenario.ChangeUavColourOnScenario(_ourSelectedUavFromListBox.UavName, false); } if (lsbUavs.SelectedItem != null) { Uav ourUav = UtilStkScenario.FindUavFromScenarioBasedOnName(lsbUavs.SelectedItem.ToString()); hsbThrottle.Value = (int)ourUav.ThrottleValue; UtilStkScenario.ChangeUavColourOnScenario(ourUav.UavName, true); _ourSelectedUavFromListBox = ourUav; // we don't want this thread spawning many times if (tUpdateMetricInformationInTabControl != null) { if (tUpdateMetricInformationInTabControl.IsAlive) { tUpdateMetricInformationInTabControl.Abort(); } } tUpdateMetricInformationInTabControl = new Thread(UpdateMetricInformationInTabControl); tUpdateMetricInformationInTabControl.Name = "UpdateMetricInformationInTabControlUavs"; tUpdateMetricInformationInTabControl.IsBackground = true; tUpdateMetricInformationInTabControl.Start(lsbUavs); } } delegate string GetNameOfListItem(ListBox listboxId); delegate void SetTextBoxValue(TextBox textBoxId, string valueToSet); private void UpdateMetricInformationInTabControl(object listBoxToUpdate) { ListBox theListBoxToUpdate = (ListBox)listBoxToUpdate; GetNameOfListItem dGetNameOfListItem = new GetNameOfListItem(GetNameOfSelectedListItem); SetTextBoxValue dSetTextBoxValue = new SetTextBoxValue(SetNamedTextBoxValue); try { foreach (KeyValuePair<string, IAgStkObject> entity in UtilStkScenario._totalListOfAllStkObjects) { if (entity.Key.ToString() == (string)theListBoxToUpdate.Invoke(dGetNameOfListItem, theListBoxToUpdate)) { while ((string)theListBoxToUpdate.Invoke(dGetNameOfListItem, theListBoxToUpdate) == entity.Key.ToString()) { if (theListBoxToUpdate.Name == "lsbEntities") { double[] latLonAndAltOfEntity = UtilStkScenario.FindMetricsOfStkObjectOnScenario(UtilStkScenario._stkObjectRoot.CurrentTime, entity.Value); SetEntityOrUavMetricValuesInTextBoxes(dSetTextBoxValue, "Entity", entity.Key, "", "", "", "", latLonAndAltOfEntity[4].ToString(), latLonAndAltOfEntity[3].ToString()); } else if (theListBoxToUpdate.Name == "lsbUavs") { double[] latLonAndAltOfEntity = UtilStkScenario.FindMetricsOfStkObjectOnScenario(UtilStkScenario._stkObjectRoot.CurrentTime, entity.Value); SetEntityOrUavMetricValuesInTextBoxes(dSetTextBoxValue, "UAV", entity.Key, entity.Value.ClassName.ToString(), latLonAndAltOfEntity[0].ToString(), latLonAndAltOfEntity[1].ToString(), latLonAndAltOfEntity[2].ToString(), latLonAndAltOfEntity[4].ToString(), latLonAndAltOfEntity[3].ToString()); } } } } } catch (Exception e) { // selected entity was deleted(end-of-life) in STK - remove LLA information from GUI if (theListBoxToUpdate.Name == "lsbEntities") { SetEntityOrUavMetricValuesInTextBoxes(dSetTextBoxValue, "Entity", "", "", "", "", "", "", ""); UtilLog.Log(e.Message.ToString(), e.GetType().ToString(), "UpdateMetricInformationInTabControl", UtilLog.logWriter); } else if (theListBoxToUpdate.Name == "lsbUavs") { SetEntityOrUavMetricValuesInTextBoxes(dSetTextBoxValue, "UAV", "", "", "", "", "", "", ""); UtilLog.Log(e.Message.ToString(), e.GetType().ToString(), "UpdateMetricInformationInTabControl", UtilLog.logWriter); } } } internal static double[] FindMetricsOfStkObjectOnScenario(object timeToFindMetricState, IAgStkObject stkObject) { double[] stkObjectMetrics = null; try { stkObjectMetrics = new double[5]; object latOfStkObject, lonOfStkObject; double altOfStkObject, headingOfStkObject, velocityOfStkObject; IAgProvideSpatialInfo spatial = stkObject as IAgProvideSpatialInfo; IAgVeSpatialInfo spatialInfo = spatial.GetSpatialInfo(false); IAgSpatialState spatialState = spatialInfo.GetState(timeToFindMetricState); spatialState.FixedPosition.QueryPlanetodetic(out latOfStkObject, out lonOfStkObject, out altOfStkObject); double[] stkObjectheadingAndVelocity = FindHeadingAndVelocityOfStkObjectFromScenario(stkObject.InstanceName); headingOfStkObject = stkObjectheadingAndVelocity[0]; velocityOfStkObject = stkObjectheadingAndVelocity[1]; stkObjectMetrics[0] = (double)latOfStkObject; stkObjectMetrics[1] = (double)lonOfStkObject; stkObjectMetrics[2] = altOfStkObject; stkObjectMetrics[3] = headingOfStkObject; stkObjectMetrics[4] = velocityOfStkObject; } catch (Exception e) { UtilLog.Log(e.Message.ToString(), e.GetType().ToString(), "FindMetricsOfStkObjectOnScenario", UtilLog.logWriter); } return stkObjectMetrics; } private static double[] FindHeadingAndVelocityOfStkObjectFromScenario(string stkObjectName) { double[] stkObjectHeadingAndVelocity = new double[2]; IAgStkObject stkUavObject = null; try { string typeOfObject = CheckIfStkObjectIsEntityOrUav(stkObjectName); if (typeOfObject == "UAV") { stkUavObject = _stkObjectRootToIsolateForUavs.CurrentScenario.Children[stkObjectName]; IAgDataProviderGroup group = (IAgDataProviderGroup)stkUavObject.DataProviders["Heading"]; IAgDataProvider provider = (IAgDataProvider)group.Group["Fixed"]; IAgDrResult result = ((IAgDataPrvTimeVar)provider).ExecSingle(_stkObjectRootToIsolateForUavs.CurrentTime); stkObjectHeadingAndVelocity[0] = (double)result.DataSets[1].GetValues().GetValue(0); stkObjectHeadingAndVelocity[1] = (double)result.DataSets[4].GetValues().GetValue(0); } else if (typeOfObject == "Entity") { IAgStkObject stkEntityObject = _stkObjectRootToIsolateForEntities.CurrentScenario.Children[stkObjectName]; IAgDataProviderGroup group = (IAgDataProviderGroup)stkEntityObject.DataProviders["Heading"]; IAgDataProvider provider = (IAgDataProvider)group.Group["Fixed"]; IAgDrResult result = ((IAgDataPrvTimeVar)provider).ExecSingle(_stkObjectRootToIsolateForEntities.CurrentTime); stkObjectHeadingAndVelocity[0] = (double)result.DataSets[1].GetValues().GetValue(0); stkObjectHeadingAndVelocity[1] = (double)result.DataSets[4].GetValues().GetValue(0); } } catch (Exception e) { UtilLog.Log(e.Message.ToString(), e.GetType().ToString(), "FindHeadingAndVelocityOfStkObjectFromScenario", UtilLog.logWriter); } return stkObjectHeadingAndVelocity; } Any help would be really appreciated. From my knowledge, I cant really see any issues with the C#. Maybe it has to do with the methodology I'm using.. maybe some kind of caching mechanism is required - this is not natively available. WulfgarPro

    Read the article

  • Why use one dimensional array instead of a two dimensional arrray?

    - by user3869145
    I was doing some work handling a lot of information and my partner told me that I was using too many matrices to manipulate the variables of the problem. The idea was to use one dimension arrays int a[] instead of the 2 dimensional arrays int b[][], to save memory and processing speed of the algorithm. How certain is that this change will accelerate the speed of execution or compilation of my code in c ++?

    Read the article

  • Why is i-- faster than i++ in loops? [closed]

    - by Afshin Mehrabani
    Possible Duplicate: JavaScript - Are loops really faster in reverse…? I don't know if this question is valid in other languages or not, but I'm asking this specifically for JavaScript. I see in some articles and questions that the fastest loop in JavaScript is something like: for(var i = array.length; i--; ) Also in Sublime Text 2, when you try to write a loop, it suggests: for (var i = Things.length - 1; i >= 0; i--) { Things[i] }; I want to know, why is i-- faster than i++ in loops?

    Read the article

  • Help optimizing a query with 16 subqueries

    - by Webnet
    I have indexes/primaries on all appropriate ID fields for each type. I'm wondering though how I could make this more efficient. It takes a while to load the page with only 15,000 rows and that'll quickly grow to 500k. The $whereSql variable simply has a few more parameters for the main ebay_archive_listing table. NOTE: This is all done in a single query because I have ASC/DESC sorting for each subquery value. NOTE: I've converted some of the sub queries to INNER JOIN's SELECT product_master.product_id, ( SELECT COUNT(listing_id) FROM ebay_archive_product_listing_assoc '.$listingCountJoin.' WHERE ebay_archive_product_listing_assoc.product_id = product_master.product_id) as listing_count, sku, type_id, ( SELECT AVG(ebay_archive_listing.current_price) FROM ebay_archive_listing INNER JOIN ebay_archive_product_listing_assoc ON ( ebay_archive_product_listing_assoc.listing_id = ebay_archive_listing.id AND ebay_archive_product_listing_assoc.product_id = product_master.product_id ) WHERE '.$whereSql.' AND ebay_archive_listing.current_price > 0 ) as average_bid_price, ( SELECT AVG(ebay_archive_listing.buy_it_now_price) FROM ebay_archive_listing INNER JOIN ebay_archive_product_listing_assoc ON ( ebay_archive_product_listing_assoc.listing_id = ebay_archive_listing.id AND ebay_archive_product_listing_assoc.product_id = product_master.product_id ) WHERE '.$whereSql.' AND ebay_archive_listing.buy_it_now_price > 0 ) as average_buyout_price, ( SELECT MIN(ebay_archive_listing.current_price) FROM ebay_archive_listing INNER JOIN ebay_archive_product_listing_assoc ON ( ebay_archive_product_listing_assoc.listing_id = ebay_archive_listing.id AND ebay_archive_product_listing_assoc.product_id = product_master.product_id ) WHERE '.$whereSql.' AND ebay_archive_listing.current_price > 0 ) as lowest_bid_price, ( SELECT MAX(ebay_archive_listing.current_price) FROM ebay_archive_listing INNER JOIN ebay_archive_product_listing_assoc ON ( ebay_archive_product_listing_assoc.listing_id = ebay_archive_listing.id AND ebay_archive_product_listing_assoc.product_id = product_master.product_id ) WHERE '.$whereSql.' AND ebay_archive_listing.current_price > 0 ) as highest_bid_price, ( SELECT MIN(ebay_archive_listing.buy_it_now_price) FROM ebay_archive_listing INNER JOIN ebay_archive_product_listing_assoc ON ( ebay_archive_product_listing_assoc.listing_id = ebay_archive_listing.id AND ebay_archive_product_listing_assoc.product_id = product_master.product_id ) WHERE '.$whereSql.' AND ebay_archive_listing.current_price > 0 ) as lowest_buyout_price, ( SELECT MAX(ebay_archive_listing.buy_it_now_price) FROM ebay_archive_listing INNER JOIN ebay_archive_product_listing_assoc ON ( ebay_archive_product_listing_assoc.listing_id = ebay_archive_listing.id AND ebay_archive_product_listing_assoc.product_id = product_master.product_id ) WHERE '.$whereSql.' AND ebay_archive_listing.current_price > 0 ) as highest_buyout_price, round((( SELECT COUNT(ebay_archive_listing.id) FROM ebay_archive_listing INNER JOIN ebay_archive_product_listing_assoc ON ( ebay_archive_product_listing_assoc.listing_id = ebay_archive_listing.id AND ebay_archive_product_listing_assoc.product_id = product_master.product_id ) WHERE '.$whereSql.' AND ebay_archive_listing.status_id = 2 ) / ( SELECT COUNT(listing_id) FROM ebay_archive_product_listing_assoc '.$listingCountJoin.' WHERE ebay_archive_product_listing_assoc.product_id = product_master.product_id ) * 100), 1) as sold_percent FROM product_master '.$joinSql.' WHERE product_master.product_id IN ( SELECT product_id FROM ebay_archive_product_listing_assoc INNER JOIN ebay_archive_listing ON ( ebay_archive_listing.id = ebay_archive_product_listing_assoc.listing_id AND '.$whereSql.' ) )

    Read the article

  • How to speed up a query?

    - by Soroush Khosravi
    I have a table that every request to the server, stores on it. For each request I will check that it is banned or not. For example it is a query: select * from requests where request_sessID = '4bc0331d983000902b4718c80f12e9b3' AND request_time > (UNIX_TIMESTAMP() - 3600) AND request_isEnable = 1 I also set the engine from InnoDB to MyISAM and row_format to Dynamic but nothing changed. My Hardware is very strong but it took about a minute to execute ! I am a programmer and newbie to mysql How can Speed Up this query? Thanks in Advance

    Read the article

  • JavaScript: One ID, two functions. How can I do this with minimal code duplication?

    - by user1775598
    I've got an ID and I'd like to assign two functions to it. Here's what it currently looks like: document.getElementById(this.config.dragArea).addEventListener("drop", this._dropFiles, false); document.getElementById(this.config.dragArea).addEventListener("drop", this._handleFileDrop, false); How can I rewrite this file without so much duplication? I tried doing document.getElementById(this.config.dragArea).addEventListener("drop", this._dropFiles, this._handleFileDrop, false); and document.getElementById(this.config.dragArea).addEventListener("drop", function(){this._dropFiles; this._handleFileDrop}, false); All to no avail :(

    Read the article

  • JS best practice for member functions

    - by MickMalone1983
    I'm writing a little mobile games library, and I'm not sure the best practice for declaring member functions of instantiated function objects. For instance, I might create a simple object with one property, and a method to print it: function Foo(id){ this.id = id; this.print = function(){ console.log(this.id); }; }; However, a function which does not need access to 'private' members of the function does not need to be declared in the function at all. I could equally have written: function print(){ console.log(this.id); }; function Foo(id){ this.id = id; this.print = print; }; When the function is invoked through an instance of Foo, the instance becomes the context for this, so the output is the same in either case. I'm not entirely sure how memory is allocated with JS, and I can't find anything that I can understand about something this specific, but it seems to me that with the first example all members of Foo, including the print function, are duplicated each time it is instantiated - but with the second, it just gets a pointer to one, pre-declared function, which would save any more memory having to be allocated as more instances of Foo are created. Am I correct, and if I am, is there any memory/performance benefit to doing this?

    Read the article

  • [PHP] Does unsetting array values during iterating save on memory?

    - by saturn_rising
    Hello fellow code warriors, This is a simple programming question, coming from my lack of knowledge of how PHP handles array copying and unsetting during a foreach loop. It's like this, I have an array that comes to me from an outside source formatted in a way I want to change. A simple example would be: $myData = array('Key1' => array('value1', 'value2')); But what I want would be something like: $myData = array([0] => array('MyKey' => array('Key1' => array('value1', 'value2')))); So I take the first $myData and format it like the second $myData. I'm totally fine with my formatting algorithm. My question lies in finding a way to conserve memory since these arrays might get a little unwieldy. So, during my foreach loop I copy the current array value(s) into the new format, then I unset the value I'm working with from the original array. E.g.: $formattedData = array(); foreach ($myData as $key => $val) { // do some formatting here, copy to $reformattedVal $formattedData[] = $reformattedVal; unset($myData[$key]); } Is the call to unset() a good idea here? I.e., does it conserve memory since I have copied the data and no longer need the original value? Or, does PHP automatically garbage collect the data since I don't reference it in any subsequent code? The code runs fine, and so far my datasets have been too negligible in size to test for performance differences. I just don't know if I'm setting myself up for some weird bugs or CPU hits later on. Thanks for any insights. -sR

    Read the article

  • SQL Server 05, which is optimal, LIKE %<term>% or CONTAINS() for searching large column

    - by Spud1
    I've got a function written by another developer which I am trying to modify for a slightly different use. It is used by a SP to check if a certain phrase exists in a text document stored in the DB, and returns 1 if the value is found or 0 if its not. This is the query: SELECT @mres=1 from documents where id=@DocumentID and contains(text, @search_term) The document contains mostly XML, and the search_term is a GUID formatted as an nvarchar(40). This seems to run quite slowly to me (taking 5-6 seconds to execute this part of the process), but in the same script file there is also this version of the above, commented out. SELECT @mres=1 from documents where id=@DocumentID and textlike '%' + @search_term + '%' This version runs MUCH quicker, taking 4ms compared to 15ms for the first example. So, my question is why use the first over the second? I assume this developer (who is no longer working with me) had a good reason, but at the moment I am struggling to find it.. Is it possibly something to do with the full text indexing? (this is a dev DB I am working with, so the production version may have better indexing..) I am not that clued up on FTI really so not quite sure at the moment. Thoughts/ideas?

    Read the article

  • Optimising a query for Top 5% of users

    - by Nai
    On my website, there exists a group of 'power users' who are fantastic and adding lots of content on to my site. However, their prolific activities has led to their profile pages slowing down a lot. For 95% of the other users, the SPROC that is returning the data is very quick. It's only for these group of power users, the very same SPROC is slow. How does one go about optimising the query for this group of users? You can assume that the right indexes have already been constructed. EDIT: Ok, I think I have been a bit too vague. To rephrase the question, how can I optimise my site to enhance the performance for these 5% of users. Given that this SPROC is the same one that is in use for every user and that it is already well optimised, I am guessing the next steps are to explore caching possibilities on the data and application layers?

    Read the article

  • O&rsquo;Reilly E-Book of the Day 15/Aug/2014 - Advanced Quantitative Finance with C++

    - by TATWORTH
    Originally posted on: http://geekswithblogs.net/TATWORTH/archive/2014/08/15/orsquoreilly-e-book-of-the-day-15aug2014---advanced-quantitative-finance.aspxToday’s half-price book of the Day offer from O’Reilly at http://shop.oreilly.com/product/9781782167228.do?code=MSDEAL is Advanced Quantitative Finance with C++. “This book will introduce you to the key mathematical models used to price financial derivatives, as well as the implementation of main numerical models used to solve them. In particular, equity, currency, interest rates, and credit derivatives are discussed. In the first part of the book, the main mathematical models used in the world of financial derivatives are discussed. Next, the numerical methods used to solve the mathematical models are presented. Finally, both the mathematical models and the numerical methods are used to solve some concrete problems in equity, forex, interest rate, and credit derivatives.”

    Read the article

  • How Does Your Home Based Business Rank? Unlock the Mystery of Search Engine Optimization

    For many, the words "search engine optimization" (SEO) are simply confusing buzz words used by tech heads buried in the mysterious world of internet marketing. But listen up home based business owners, SEO can be a critical component of your marketing strategy, and when broken down to its basic level, SEO is merely a tool allowing you to use the various search engines such as Google or Yahoo! and others to gain visibility for your business and drive prospects to your website. SEO marketing is the process of improving the volume of traffic to a website through natural/organic (un-paid) search results. Unlike promoting your business via pay-per-click (PPC) strategies, which lists your business at the top of search engines such as Google or Yahoo! for a fee, SEO is a strategy with the goal of ensuring placement at the top without incurring expensive placement costs.

    Read the article

  • Make the Web Fast: Automagic site optimization with mod_pagespeed 1.0!

    Make the Web Fast: Automagic site optimization with mod_pagespeed 1.0! Ask and vote for questions at: bit.ly mod_pagespeed is an open-source Apache module that automatically optimizes web pages and resources on them: images, CSS, JavaScript, and much more. In this episode, we'll catch up with Joshua Marantz, the tech lead of the project at Google and talk about the history of mod_pagespeed, its fast growing adoption (130K+ sites!), technical architecture and how it works under the hood. Finally, we'll talk about the upcoming 1.0 release milestone for the project. If you're curious about mod_pagespeed, then this is definitely the show you won't want to miss! From: GoogleDevelopers Views: 0 0 ratings Time: 00:00 More in Science & Technology

    Read the article

  • Make the Web Fast: Automagic site optimization with mod_pagespeed 1.0!

    Make the Web Fast: Automagic site optimization with mod_pagespeed 1.0! mod_pagespeed is an open-source Apache module that automatically optimizes web pages and resources on them: images, CSS, JavaScript, and much more. In this episode, we'll catch up with Joshua Marantz, the tech lead of the project at Google and talk about the history of mod_pagespeed, its fast growing adoption (130K+ sites!), technical architecture and how it works under the hood. Finally, we'll talk about the upcoming 1.0 release milestone for the project. If you're curious about mod_pagespeed, then this is definitely the show you won't want to miss! From: GoogleDevelopers Views: 2 0 ratings Time: 01:05:06 More in Science & Technology

    Read the article

  • What Are the Best Ways to Get Traffic From Search Engine Optimization Consultant?

    Every internet based business needs to go through a well planned and thought out process before it actually gets established and achieving its purpose. Obviously, the process is totally different from how a brick-and-mortar business is started and established but the basics remain the same. One of the key ingredients of the process of establishing an Internet based business is getting your website search engine optimized. Depending upon the size and complexity of business, search engine optimization may turn out to be a very detailed process if you really want it to be effective and useful.

    Read the article

  • Performance Optimization &ndash; It Is Faster When You Can Measure It

    - by Alois Kraus
    Performance optimization in bigger systems is hard because the measured numbers can vary greatly depending on the measurement method of your choice. To measure execution timing of specific methods in your application you usually use Time Measurement Method Potential Pitfalls Stopwatch Most accurate method on recent processors. Internally it uses the RDTSC instruction. Since the counter is processor specific you can get greatly different values when your thread is scheduled to another core or the core goes into a power saving mode. But things do change luckily: Intel's Designer's vol3b, section 16.11.1 "16.11.1 Invariant TSC The time stamp counter in newer processors may support an enhancement, referred to as invariant TSC. Processor's support for invariant TSC is indicated by CPUID.80000007H:EDX[8]. The invariant TSC will run at a constant rate in all ACPI P-, C-. and T-states. This is the architectural behavior moving forward. On processors with invariant TSC support, the OS may use the TSC for wall clock timer services (instead of ACPI or HPET timers). TSC reads are much more efficient and do not incur the overhead associated with a ring transition or access to a platform resource." DateTime.Now Good but it has only a resolution of 16ms which can be not enough if you want more accuracy.   Reporting Method Potential Pitfalls Console.WriteLine Ok if not called too often. Debug.Print Are you really measuring performance with Debug Builds? Shame on you. Trace.WriteLine Better but you need to plug in some good output listener like a trace file. But be aware that the first time you call this method it will read your app.config and deserialize your system.diagnostics section which does also take time.   In general it is a good idea to use some tracing library which does measure the timing for you and you only need to decorate some methods with tracing so you can later verify if something has changed for the better or worse. In my previous article I did compare measuring performance with quantum mechanics. This analogy does work surprising well. When you measure a quantum system there is a lower limit how accurately you can measure something. The Heisenberg uncertainty relation does tell us that you cannot measure of a quantum system the impulse and location of a particle at the same time with infinite accuracy. For programmers the two variables are execution time and memory allocations. If you try to measure the timings of all methods in your application you will need to store them somewhere. The fastest storage space besides the CPU cache is the memory. But if your timing values do consume all available memory there is no memory left for the actual application to run. On the other hand if you try to record all memory allocations of your application you will also need to store the data somewhere. This will cost you memory and execution time. These constraints are always there and regardless how good the marketing of tool vendors for performance and memory profilers are: Any measurement will disturb the system in a non predictable way. Commercial tool vendors will tell you they do calculate this overhead and subtract it from the measured values to give you the most accurate values but in reality it is not entirely true. After falling into the trap to trust the profiler timings several times I have got into the habit to Measure with a profiler to get an idea where potential bottlenecks are. Measure again with tracing only the specific methods to check if this method is really worth optimizing. Optimize it Measure again. Be surprised that your optimization has made things worse. Think harder Implement something that really works. Measure again Finished! - Or look for the next bottleneck. Recently I have looked into issues with serialization performance. For serialization DataContractSerializer was used and I was not sure if XML is really the most optimal wire format. After looking around I have found protobuf-net which uses Googles Protocol Buffer format which is a compact binary serialization format. What is good for Google should be good for us. A small sample app to check out performance was a matter of minutes: using ProtoBuf; using System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.Serialization; [DataContract, Serializable] class Data { [DataMember(Order=1)] public int IntValue { get; set; } [DataMember(Order = 2)] public string StringValue { get; set; } [DataMember(Order = 3)] public bool IsActivated { get; set; } [DataMember(Order = 4)] public BindingFlags Flags { get; set; } } class Program { static MemoryStream _Stream = new MemoryStream(); static MemoryStream Stream { get { _Stream.Position = 0; _Stream.SetLength(0); return _Stream; } } static void Main(string[] args) { DataContractSerializer ser = new DataContractSerializer(typeof(Data)); Data data = new Data { IntValue = 100, IsActivated = true, StringValue = "Hi this is a small string value to check if serialization does work as expected" }; var sw = Stopwatch.StartNew(); int Runs = 1000 * 1000; for (int i = 0; i < Runs; i++) { //ser.WriteObject(Stream, data); Serializer.Serialize<Data>(Stream, data); } sw.Stop(); Console.WriteLine("Did take {0:N0}ms for {1:N0} objects", sw.Elapsed.TotalMilliseconds, Runs); Console.ReadLine(); } } The results are indeed promising: Serializer Time in ms N objects protobuf-net   807 1000000 DataContract 4402 1000000 Nearly a factor 5 faster and a much more compact wire format. Lets use it! After switching over to protbuf-net the transfered wire data has dropped by a factor two (good) and the performance has worsened by nearly a factor two. How is that possible? We have measured it? Protobuf-net is much faster! As it turns out protobuf-net is faster but it has a cost: For the first time a type is de/serialized it does use some very smart code-gen which does not come for free. Lets try to measure this one by setting of our performance test app the Runs value not to one million but to 1. Serializer Time in ms N objects protobuf-net 85 1 DataContract 24 1 The code-gen overhead is significant and can take up to 200ms for more complex types. The break even point where the code-gen cost is amortized by its faster serialization performance is (assuming small objects) somewhere between 20.000-40.000 serialized objects. As it turned out my specific scenario involved about 100 types and 1000 serializations in total. That explains why the good old DataContractSerializer is not so easy to take out of business. The final approach I ended up was to reduce the number of types and to serialize primitive types via BinaryWriter directly which turned out to be a pretty good alternative. It sounded good until I measured again and found that my optimizations so far do not help much. After looking more deeper at the profiling data I did found that one of the 1000 calls did take 50% of the time. So how do I find out which call it was? Normal profilers do fail short at this discipline. A (totally undeserved) relatively unknown profiler is SpeedTrace which does unlike normal profilers create traces of your applications by instrumenting your IL code at runtime. This way you can look at the full call stack of the one slow serializer call to find out if this stack was something special. Unfortunately the call stack showed nothing special. But luckily I have my own tracing as well and I could see that the slow serializer call did happen during the serialization of a bool value. When you encounter after much analysis something unreasonable you cannot explain it then the chances are good that your thread was suspended by the garbage collector. If there is a problem with excessive GCs remains to be investigated but so far the serialization performance seems to be mostly ok.  When you do profile a complex system with many interconnected processes you can never be sure that the timings you just did measure are accurate at all. Some process might be hitting the disc slowing things down for all other processes for some seconds as well. There is a big difference between warm and cold startup. If you restart all processes you can basically forget the first run because of the OS disc cache, JIT and GCs make the measured timings very flexible. When you are in need of a random number generator you should measure cold startup times of a sufficiently complex system. After the first run you can try again getting different and much lower numbers. Now try again at least two times to get some feeling how stable the numbers are. Oh and try to do the same thing the next day. It might be that the bottleneck you found yesterday is gone today. Thanks to GC and other random stuff it can become pretty hard to find stuff worth optimizing if no big bottlenecks except bloatloads of code are left anymore. When I have found a spot worth optimizing I do make the code changes and do measure again to check if something has changed. If it has got slower and I am certain that my change should have made it faster I can blame the GC again. The thing is that if you optimize stuff and you allocate less objects the GC times will shift to some other location. If you are unlucky it will make your faster working code slower because you see now GCs at times where none were before. This is where the stuff does get really tricky. A safe escape hatch is to create a repro of the slow code in an isolated application so you can change things fast in a reliable manner. Then the normal profilers do also start working again. As Vance Morrison does point out it is much more complex to profile a system against the wall clock compared to optimize for CPU time. The reason is that for wall clock time analysis you need to understand how your system does work and which threads (if you have not one but perhaps 20) are causing a visible delay to the end user and which threads can wait a long time without affecting the user experience at all. Next time: Commercial profiler shootout.

    Read the article

  • What is the command for Index optimization and update statistics for Oracle 10g and 11g?

    - by indra
    I am Loading large no of rows into a table from a csv data file . For every 10000 records I want to update the indexs on the table for optimization (update statistics ). Any body tell me what is the command i can use? Also what is MSSQL "UPDATE STATISTICS" equivalent in Oracle.is Update statistics means index optimization or gatehring statistics. I am using Oracle 10g and 11g. Thanks in advance.

    Read the article

  • Are One Way Links Still Important in Search Engine Optimization?

    Pretty dumb question huh? But people are beginning to wonder considering that Google might change its algorithms again. If you doubt it, do a quick search on the keyword "Google caffeine". This is the new Google search engine and so far, beta testers have stated that it is faster, provides more relevant search engine results and son. Anyways, whatever the case may be, it is important to note that one way links are important right now because the search engines have made them so.

    Read the article

  • Search Engine Optimization Services - Offering Cost-Effective Marketing Strategy!

    It's the increasing popularity for the Internet that is exactly propelling more and more businessmen to announce their website in order to draw customers around the world. These days, the Internet has been considered as the most effective marketing and product promotion platform that can take business for new heights. If you are all set to get some international clients, then its time to opt for the SEO services.

    Read the article

< Previous Page | 70 71 72 73 74 75 76 77 78 79 80 81  | Next Page >