Tag

loop optimization

0 views collected around this technical thread.

Python Programming Learning Circle
Python Programming Learning Circle
Apr 29, 2025 · Fundamentals

Simple Techniques to Accelerate Python For‑Loops: From 1.3× to 970× Speed‑ups

This article presents a collection of practical Python tricks—such as list comprehensions, pre‑computing lengths, using sets, skipping irrelevant iterations, inlining functions, generators, map, memoization, vectorization, filterfalse, and join—to dramatically improve for‑loop performance, with benchmark results ranging from modest 1.3× gains up to a staggering 970× acceleration.

Pythonbenchmarkcode optimization
0 likes · 13 min read
Simple Techniques to Accelerate Python For‑Loops: From 1.3× to 970× Speed‑ups
Python Programming Learning Circle
Python Programming Learning Circle
Apr 22, 2025 · Fundamentals

Why and How to Avoid Writing For Loops in Python

The article explains why you should challenge yourself to avoid explicit for loops in Python and demonstrates how to replace them with list comprehensions, generator expressions, map/reduce, and itertools, resulting in shorter, more readable, and better‑structured code.

Functional ProgrammingGeneratorPython
0 likes · 7 min read
Why and How to Avoid Writing For Loops in Python
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Sep 3, 2024 · Fundamentals

Understanding JavaScript Loop Optimization and Primitive Wrapper Objects

This article examines why storing a string's length in a variable can improve loop performance in JavaScript, explains primitive data types and their wrapper objects, and demonstrates the underlying mechanisms with code examples and timing tests.

JavaScriptPrimitive TypesWrapper Objects
0 likes · 5 min read
Understanding JavaScript Loop Optimization and Primitive Wrapper Objects
Python Programming Learning Circle
Python Programming Learning Circle
Aug 6, 2024 · Fundamentals

Four Time‑Saving Python Tricks to Boost Execution Speed

This article presents four practical Python performance tricks—including list reversal with slicing versus reverse(), one‑line variable swapping, moving loops inside functions, and reducing function calls—each demonstrated with code examples and timing results that show measurable speed improvements.

OptimizationPythonlist reversal
0 likes · 5 min read
Four Time‑Saving Python Tricks to Boost Execution Speed
Python Programming Learning Circle
Python Programming Learning Circle
Mar 25, 2024 · Fundamentals

Simple Techniques to Accelerate Python for‑loops (1.3× to 970× Speedup)

This article presents a collection of practical Python techniques—such as list comprehensions, pre‑computing lengths, using sets, skipping irrelevant iterations, inlining functions, generators, map, memoization, vectorization, filterfalse, and join—that together can boost for‑loop performance anywhere from 1.3‑fold up to nearly a thousand times, with concrete code examples and benchmark results.

Code ProfilingPythonSpeedup
0 likes · 16 min read
Simple Techniques to Accelerate Python for‑loops (1.3× to 970× Speedup)
Top Architecture Tech Stack
Top Architecture Tech Stack
Feb 5, 2024 · Fundamentals

Simple Techniques to Speed Up Python For Loops by 1.3× to 970×

This article presents a collection of straightforward Python techniques—such as list comprehensions, external length calculation, set usage, early‑exit loops, inlining functions, pre‑computations, generators, map(), memoization, NumPy vectorization, filterfalse, and join()—that can accelerate for‑loops anywhere from 1.3‑fold up to nearly a thousand‑fold, with explanations and benchmark results.

GeneratorsNumPyPython
0 likes · 18 min read
Simple Techniques to Speed Up Python For Loops by 1.3× to 970×
Python Programming Learning Circle
Python Programming Learning Circle
Jan 4, 2024 · Fundamentals

Simple Methods to Speed Up Python For Loops (1.3× to 970×)

This article presents a series of practical techniques—such as list comprehensions, pre‑computing lengths, using sets, skipping irrelevant iterations, inlining functions, generators, map, memoization, vectorization, and efficient string joining—that can accelerate Python for‑loops anywhere from 1.3‑fold up to 970‑fold, with concrete benchmark results and code examples.

PythonVectorizationlist comprehension
0 likes · 15 min read
Simple Methods to Speed Up Python For Loops (1.3× to 970×)
Python Programming Learning Circle
Python Programming Learning Circle
Dec 27, 2023 · Fundamentals

Four Python Tricks to Speed Up Execution by 10–20%

This article presents four practical Python performance tricks—list reversal, variable swapping, in‑function looping, and reducing function calls—demonstrating how each can shave 10‑20% off execution time with clear code examples and timing benchmarks.

Pythoncode optimizationlist reversal
0 likes · 6 min read
Four Python Tricks to Speed Up Execution by 10–20%