#code optimization
Explore tagged Tumblr posts
greenfutures · 7 months ago
Text
Optimizing computer code to reduce energy use can provide huge benefits.
4 notes · View notes
blubberquark · 2 years ago
Text
Wish List For A Game Profiler
I want a profiler for game development. No existing profiler currently collects the data I need. No existing profiler displays it in the format I want. No existing profiler filters and aggregates profiling data for games specifically.
I want to know what makes my game lag. Sure, I also care about certain operations taking longer than usual, or about inefficient resource usage in the worker thread. The most important question that no current profiler answers is: In the frames that currently do lag, what is the critical path that makes them take too long? Which function should I optimise first to reduce lag the most?
I know that, with the right profiler, these questions could be answered automatically.
Hybrid Sampling Profiler
My dream profiler would be a hybrid sampling/instrumenting design. It would be a sampling profiler like Austin (https://github.com/P403n1x87/austin), but a handful of key functions would be instrumented in addition to the sampling: Displaying a new frame/waiting for vsync, reading inputs, draw calls to the GPU, spawning threads, opening files and sockets, and similar operations should always be tracked. Even if displaying a frame is not a heavy operation, it is still important to measure exactly when it happens, if not how long it takes. If a draw call returns right away, and the real work on the GPU begins immediately, it’s still useful to know when the GPU started working. Without knowing exactly when inputs are read, and when a frame is displayed, it is difficult to know if a frame is lagging. Especially when those operations are fast, they are likely to be missed by a sampling debugger.
Tracking Other Resources
It would be a good idea to collect CPU core utilisation, GPU utilisation, and memory allocation/usage as well. What does it mean when one thread spends all of its time in that function? Is it idling? Is it busy-waiting? Is it waiting for another thread? Which one?
It would also be nice to know if a thread is waiting for IO. This is probably a “heavy” operation and would slow the game down.
There are many different vendor-specific tools for GPU debugging, some old ones that worked well for OpenGL but are no longer developed, open-source tools that require source code changes in your game, and the newest ones directly from GPU manufacturers that only support DirectX 12 or Vulkan, but no OpenGL or graphics card that was built before 2018. It would probably be better to err on the side of collecting less data and supporting more hardware and graphics APIs.
The profiler should collect enough data to answer questions like: Why is my game lagging even though the CPU is utilised at 60% and the GPU is utilised at 30%? During that function call in the main thread, was the GPU doing something, and were the other cores idling?
Engine/Framework/Scripting Aware
The profiler knows which samples/stack frames are inside gameplay or engine code, native or interpreted code, project-specific or third-party code.
In my experience, it’s not particularly useful to know that the code spent 50% of the time in ceval.c, or 40% of the time in SDL_LowerBlit, but that’s the level of granularity provided by many profilers.
Instead, the profiler should record interpreted code, and allow the game to set a hint if the game is in turn interpreting code. For example, if there is a dialogue engine, that engine could set a global “interpreting dialogue” flag and a “current conversation file and line” variable based on source maps, and the profiler would record those, instead of stopping at the dialogue interpreter-loop function.
Of course, this feature requires some cooperation from the game engine or scripting language.
Catching Common Performance Mistakes
With a hybrid sampling/instrumenting profiler that knows about frames or game state update steps, it is possible to instrument many or most “heavy“ functions. Maybe this functionality should be turned off by default. If most “heavy functions“, for example “parsing a TTF file to create a font object“, are instrumented, the profiler can automatically highlight a mistake when the programmer loads a font from disk during every frame, a hundred frames in a row.
This would not be part of the sampling stage, but part of the visualisation/analysis stage.
Filtering for User Experience
If the profiler knows how long a frame takes, and how much time is spent waiting during each frame, we can safely disregard those frames that complete quickly, with some time to spare. The frames that concern us are those that lag, or those that are dropped. For example, imagine a game spends 30% of its CPU time on culling, and 10% on collision detection. You would think to optimise the culling. What if the collision detection takes 1 ms during most frames, culling always takes 8 ms, but whenever the player fires a bullet, the collision detection causes a lag spike. The time spent on culling is not the problem here.
This would probably not be part of the sampling stage, but part of the visualisation/analysis stage. Still, you could use this information to discard “fast enough“ frames and re-use the memory, and only focus on keeping profiling information from the worst cases.
Aggregating By Code Paths
This is easier when you don’t use an engine, but it can probably also be done if the profiler is “engine-aware”. It would require some per-engine custom code though. Instead of saying “The game spent 30% of the time doing vector addition“, or smarter “The game spent 10% of the frames that lagged most in the MobAIRebuildMesh function“, I want the game to distinguish between game states like “inventory menu“, “spell targeting (first person)“ or “switching to adjacent area“. If the game does not use a data-driven engine, but multiple hand-written game loops, these states can easily be distinguished (but perhaps not labelled) by comparing call stacks: Different states with different game loops call the code to update the screen from different places – and different code paths could have completely different performance characteristics, so it makes sense to evaluate them separately.
Because the hypothetical hybrid profiler instruments key functions, enough call stack information to distinguish different code paths is usually available, and the profiler might be able to automatically distinguish between the loading screen, the main menu, and the game world, without any need for the code to give hints to the profiler.
This could also help to keep the memory usage of the profiler down without discarding too much interesting information, by only keeping the 100 worst frames per code path. This way, the profiler can collect performance data on the gameplay without running out of RAM during the loading screen.
In a data-driven engine like Unity, I’d expect everything to happen all the time, on the same, well-optimised code path. But this is not a wish list for a Unity profiler. This is a wish list for a profiler for your own custom game engine, glue code, and dialogue trees.
All I need is a profiler that is a little smarter, that is aware of SDL, OpenGL, Vulkan, and YarnSpinner or Ink. Ideally, I would need somebody else to write it for me.
6 notes · View notes
datameticasols · 2 months ago
Text
Take Your Cloud Cost Optimization to the Next Level with Datametica’s Workload Optimization
Tumblr media
As organizations migrate their data warehouses to the cloud, managing increasing cloud costs becomes a major challenge. Datametica’s cloud optimization services help tackle this issue by optimizing workloads for improved performance and reduced costs. By refining data models, code, and architecture, businesses can streamline operations, minimize resource usage, and achieve higher ROI.
Datametica’s approach to workload optimization includes:
Data Model Optimization: Reducing storage needs and improving query performance.
Code Optimization: Enhancing efficiency and reducing resource consumption.
Architecture Optimization: Removing bottlenecks and improving scalability.
By integrating FinOps principles, businesses can optimize their cloud spend, reduce wastage, and maximize the value of their cloud investments.
0 notes
specbee-c-s · 4 months ago
Text
Fine-tune Drupal performance using XHProf profiling
Is your Drupal site running slow? Discover how XHProf profiling can help you pinpoint performance bottlenecks, optimize your code, and speed up your website.
Tumblr media
0 notes
prajapati-om07 · 11 months ago
Text
Upgrading to PHP 8: Tips and Tricks for a Smooth Transition
Tumblr media
Prepare for a seamless transition to PHP 8 with our comprehensive guide on upgrading. As PHP evolves, moving to version 8 brings exciting new features and improvements, but it also requires careful planning to ensure compatibility and performance.
Our expert tips and tricks cover essential aspects such as deprecated features, syntax changes, and best practices for code optimization. Whether you're a developer, system administrator, or business owner, this resource will help you navigate the upgrade process efficiently. Stay ahead with insights into error handling, performance benchmarks, and tools for testing compatibility.
By implementing our recommendations, you can minimize downtime, enhance security, and take full advantage of PHP 8's capabilities.
0 notes
ourwitching · 11 months ago
Link
With performance optimizations seemingly having lost their relevance in an era of ever-increasing ha...
0 notes
intelliatech · 1 year ago
Text
Top 10 ChatGPT Prompts For Software Developers
Tumblr media
ChatGPT can do a lot more than just code creation and this blog post is going to be all about that. We have curated a list of ChatGPT prompts that will help software developers with their everyday tasks. ChatGPT can respond to questions and can compose codes making it a very helpful tool for software engineers.
While this AI tool can help developers with the entire SDLC (Software Development Lifecycle), it is important to understand how to use the prompts effectively for different needs.
Prompt engineering gives users accurate results. Since ChatGPT accepts prompts, we receive more precise answers. But a lot depends on how these prompts are formulated. 
To Get The Best Out Of ChatGPT, Your Prompts Should Be:
Clear and well-defined. The more detailed your prompts, the better suggestions you will receive from ChatGPT.
Specify the functionality and programming language. Not specifying what you exactly need might not give you the desired results.
Phrase your prompts in a natural language, as if asking someone for help. This will make ChatGPT understand your problem better and give more relevant outputs.
Avoid unnecessary information and ambiguity. Keep it not only to the point but also inclusive of all important details.
Top ChatGPT Prompts For Software Developers
Let’s quickly have a look at some of the best ChatGPT prompts to assist you with various stages of your Software development lifecycle.
1. For Practicing SQL Commands;
Tumblr media
2. For Becoming A Programming Language Interpreter;
Tumblr media
3. For Creating Regular Expressions Since They Help In Managing, Locating, And Matching Text.
Tumblr media
4. For Generating Architectural Diagrams For Your Software Requirements.
Prompt Examples: I want you to act as a Graphviz DOT generator, an expert to create meaningful diagrams. The diagram should have at least n nodes (I specify n in my input by writing [n], 10 being the default value) and to be an accurate and complex representation of the given input. Each node is indexed by a number to reduce the size of the output, should not include any styling, and with layout=neato, overlap=false, node [shape=rectangle] as parameters. The code should be valid, bugless and returned on a single line, without any explanation. Provide a clear and organized diagram, the relationships between the nodes have to make sense for an expert of that input. My first diagram is: “The water cycle [8]”.  
Tumblr media
5. For Solving Git Problems And Getting Guidance On Overcoming Them.
Prompt Examples: “Explain how to resolve this Git merge conflict: [conflict details].” 6. For Code generation- ChatGPT can help generate a code based on descriptions given by you. It can write pieces of codes based on the requirements given in the input. Prompt Examples: -Write a program/function to {explain functionality} in {programming language} -Create a code snippet for checking if a file exists in Python. -Create a function that merges two lists into a dictionary in JavaScript.  
7. For Code Review And Debugging: ChatGPT Can Review Your Code Snippet And Also Share Bugs.
Prompt Examples: -Here’s a C# code snippet. The function is supposed to return the maximum value from the given list, but it’s not returning the expected output. Can you identify the problem? [Enter your code here] -Can you help me debug this error message from my C# program: [error message] -Help me debug this Python script that processes a list of objects and suggests possible fixes. [Enter your code here]
8. For Knowing The Coding Best Practices And Principles: It Is Very Important To Be Updated With Industry’s Best Practices In Coding. This Helps To Maintain The Codebase When The Organization Grows.
Prompt Examples: -What are some common mistakes to avoid when writing code? -What are the best practices for security testing? -Show me best practices for writing {concept or function} in {programming language}.  
9. For Code Optimization: ChatGPT Can Help Optimize The Code And Enhance Its Readability And Performance To Make It Look More Efficient.
Prompt Examples: -Optimize the following {programming language} code which {explain the functioning}: {code snippet} -Suggest improvements to optimize this C# function: [code snippet] -What are some strategies for reducing memory usage and optimizing data structures? 
10. For Creating Boilerplate Code: ChatGPT Can Help In Boilerplate Code Generation.
Prompt Examples: -Create a basic Java Spring Boot application boilerplate code. -Create a basic Python class boilerplate code
11. For Bug Fixes: Using ChatGPT Helps Fixing The Bugs Thus Saving A Large Chunk Of Time In Software Development And Also Increasing Productivity.
Prompt Examples: -How do I fix the following {programming language} code which {explain the functioning}? {code snippet} -Can you generate a bug report? -Find bugs in the following JavaScript code: (enter code)  
12. Code Refactoring- ChatGPt Can Refactor The Code And Reduce Errors To Enhance Code Efficiency, Thus Making It Easier To Modify In The Future.
Prompt Examples –What are some techniques for refactoring code to improve code reuse and promote the use of design patterns? -I have duplicate code in my project. How can I refactor it to eliminate redundancy?  
13. For Choosing Deployment Strategies- ChatGPT Can Suggest Deployment Strategies Best Suited For A Particular Project And To Ensure That It Runs Smoothly.
Prompt Examples -What are the best deployment strategies for this software project? {explain the project} -What are the best practices for version control and release management?  
14. For Creating Unit Tests- ChatGPT Can Write Test Cases For You
Prompt Examples: -How does test-driven development help improve code quality? -What are some best practices for implementing test-driven development in a project? These were some prompt examples for you that we sourced on the basis of different requirements a developer can have. So whether you have to generate a code or understand a concept, ChatGPT can really make a developer’s life by doing a lot of tasks. However, it certainly comes with its own set of challenges and cannot always be completely correct. So it is advisable to cross-check the responses. Hope this helps. Visit us- Intelliatech
0 notes
attitudeacademu4u · 1 year ago
Text
From Concept to Clicks: Navigating the Path to Successful Website Developer
Tumblr media
Introduction:
In the dynamic world of digital evolution, a website's triumph extends beyond mere aesthetics. Building a successful website demands a methodical journey, navigating through the realms of concept to the decisive click. This blog delves into the pivotal aspects of website development, accentuating the significance of intuitive interfaces and the art of streamlined code optimization.
The Foundation: Designing Intuitively Navigable Websites
At the core of every thriving website lies an intuitively designed interface. User experience (UX) stands as the linchpin capable of transforming a casual browser into a dedicated customer. When conceptualizing your website, prioritize a seamless and intuitive navigation structure. Tailor the design to resonate with the preferences and expectations of your target audience. The essence of success lies in user-friendly design.
Blueprinting with Wireframes and Prototypes: Laying the Groundwork
Before immersing yourself in the intricacies of coding, establish a blueprint for your website through meticulous wireframing and prototyping. These visual blueprints serve as the groundwork for development, aiding in the identification of potential user experience hurdles and refining the design further.
Code Optimization: The Pillar of Peak Performance
As the development journey unfolds, the importance of code optimization cannot be overstated. Efficient code forms the backbone of a high-performing website. Search engines favor well-optimized code, leading to enhanced rankings and visibility. Moreover, streamlined code contributes to swift loading times, elevating the overall user experience. Code optimization serves as the architectural pillar of digital success.
Adapting to Every Screen: The Era of Responsive Design
In this era dominated by mobile devices, a website's triumph is intricately linked to its responsiveness across diverse screens. Implementing a responsive design ensures your website seamlessly adapts to varying screen sizes, delivering an optimal viewing experience for users on smartphones, tablets, and desktops alike.
Rigorous Testing: Guaranteeing Functionality and Excellence
Before unveiling your website to the digital sphere, comprehensive testing is imperative. Conduct usability tests to pinpoint potential user interaction bottlenecks. Simultaneously, evaluate your website's performance across various browsers and devices. Rigorous testing assures that your website remains functional, accessible, and enjoyable for users across the spectrum.
Conclusion:
Embarking on the journey from conceptualization to user interaction demands a strategic amalgamation of user-friendly design and precision code optimization. A triumphant website surpasses visual allure; it evolves into a meticulously crafted digital experience that prioritizes the needs and expectations of its users. By focusing on intuitive interfaces and code optimization, you carve the path for a website that not only captivates attention but also nurtures and converts visitors into steadfast patrons.
0 notes
clonecoding-en · 2 years ago
Link
Efficient JavaScript with Spread Syntax
Mastering the Art of Efficient JavaScript with Spread Syntax
The spread syntax in modern JavaScript empowers developers to handle arrays and objects efficiently. This comprehensive article delves deep into the world of spread syntax, unveiling its versatile applications and addressing common pitfalls.
By exploring real-world scenarios and code examples, readers gain a profound understanding of how to leverage spread syntax for tasks such as merging arrays, copying objects, and passing dynamic arguments to functions. This article also equips developers with the knowledge to identify and troubleshoot errors that may arise when misusing spread syntax.
Navigating through the complexities of spread syntax, developers will learn how to write code that is not only concise and effective but also avoids common misconceptions and pitfalls. Whether you're new to JavaScript or an experienced developer, this article provides valuable insights into harnessing the power of spread syntax for optimal code efficiency and readability.
0 notes
soupysuki · 6 months ago
Text
Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media
the universe question
226 notes · View notes
ryonello · 10 months ago
Text
Tumblr media
i have ........... a new meowmeow fixation .........
369 notes · View notes
tragedytells-tales · 2 days ago
Text
Tumblr media
Today's warm up doodle, when the journey to the west has a monkie kid and it's epic
Open Arms is what would've happened had Wukong found out about Macaque training MK sooner and MK made it his mission to make them get along
41 notes · View notes
agerasiaa · 2 months ago
Text
legacy? no babe, that’s just the trauma pipeline with extra steps. and lifelong performance review I never asked for
44 notes · View notes
taldigi · 15 days ago
Text
Tumblr media
but look at thebullshit i had to pull just to get the textboxes to tilt
and you know what they wouldn't let me put an img between box-shadow and the box so
@kumakechi thank you for your prayers
8 notes · View notes
dekusleftsock · 11 months ago
Text
Tumblr media Tumblr media
Leaks aren’t until tomorrow we can prepare🙏🙏🙏
And sorry to be that person but unless you can say you will not freak out in any way at the end of the manga tomorrow, I sincerely advise that you take a break. It is, of course, a superhero comic, and while I can say that it genuinely changed my own ideals about morality..or life in general—it’s still just a story, at the end of the day. It is fictional. Turn off tumblr and Twitter and tiktok, or better yet, delete them. For the day. Just chill. Have fun.
Actually, delete them today! Delete delete delete. Take care of yourself. Don’t torture yourself by going through all the anxieties and what ifs and doom scrolling.
The manga is supposed to be something fun to look forward to, it shouldn’t dictate your life if you can help it.
So good luck, have a glass of water, touch some grass, go see your mother, and I wish you all fulfillment and happiness regarding the ending.
Thank you so much mha for all the memories—so until tomorrow, goodnight!
32 notes · View notes
stormyrainyday · 5 months ago
Text
beyblade (metal fight) and genshin fans please lend me your strength in designing a special move for Bennett and freminet I've made Bennett a balance type bey (blitz tempo) and freminet an attack type (spiral byxis) they're both on my blog I'll link it in the morning if I remember but I have an idea cooking for them but I need to assign them special moves before it can happen
10 notes · View notes