Filter
Exclude
Time range
-
Near
Replying to @non_linear_Schr
I've found Mathematica is sometimes not much slower than C / BLAS LAPACK, when used properly. Extensive use of LinearSolve, SparseArray, N[], and CholeskyDecomposition[]. eg. this Crank-Nicolson method with 600 solves of a 625,000 by 625,000 sparse square matrix, the linear algebra time is 6.2 seconds, and it's the plotting and video encoding that eats up time! Example notebook: wolframcloud.com/obj/62f48ef… (This project is a pet favorite of mine, can you tell?)
2
1
2
339
DynamicsLLM:用 LLM 生成智能执行轨迹检测 Android 行为代码异味 Android 应用中存在的"行为代码异味"(Behavioural Code Smells)是一类在运行时才会暴露的问题——代码在语法上完全合法,但执行时会引发性能下降、内存浪费或功耗异常。现有最先进的检测工具 Dynamics 基于 MonkeyRunner 随机生成用户操作事件,召回率仅 53.4%,意味着超过四成的代码异味实例被漏检。 DynamicsLLM 的核心贡献是将 DroidAgent(基于 LLM 的 GUI Agent)引入动态检测流程,替代随机策略。LLM 能够理解应用 UI 的语义,自主规划动作序列(如:识别登录表单→填写正确格式的凭据→点击提交),而非随机乱点。实验在 333 个 F-DROID 开源应用上进行(136 个经人工标注)。结果:在固定 100 个动作的限制下,100% LLM 配置覆盖了约 868 个代码异味事件,是 MonkeyRunner 的 3 倍;Hybrid 策略(LLM MonkeyRunner 混合)在 1 小时时限内,对包含 4 个 Activity 以内的应用(占数据集 63%),覆盖率比纯 LLM 提升 25.9%;12.7% 的代码异味事件是 Dynamics 完全无法触发但 DynamicsLLM 成功触发的。检测精度 100%,NLMR(无低内存处理器)召回率 97%,HMU(HashMap 误用)召回率 73%。 论文明确指出 7 类 Android 特定的行为代码异味及其对功耗/性能/内存的影响:DW(WakeLock 未释放→功耗泄漏)、IOD(onDraw 中做额外计算→60fps 刷新放大影响)、HAS/HSS/HBR(主线程执行重操作→ANR 风险)、NLMR(低内存回调缺失→OOM)、HMU(小数据集用 HashMap→额外 GC)。 为什么值得读: 对于做 Android 性能优化的工程师来说,这篇论文提供了两个可直接落地的价值:一是系统性地定义了 7 类 Android 特有的行为代码异味,每一类都有明确的性能影响机制,可以作为代码审查的检查清单;二是论文的实验数据(NLMR 97%、HMU 73% 的召回率)说明这些异味在真实应用中并非边缘案例,而是高频出现的实际问题。 核心观点: • 随机事件生成是动态代码异味检测的主要瓶颈:MonkeyRunner 在 1 小时内执行了远多于 LLM 的动作数,但因无法正确绕过登录页、无法按正确顺序操作 UI,覆盖率反而远低于 LLM • LLM 随机混合策略对实际工程更有价值:Hybrid 在时间受限场景(63% 的应用 Activity 数量 ≤4)下表现最优,兼顾了速度与语义理解深度 • HashMap vs ArrayMap 的取舍阈值实证:HMU 代码异味在实验中被频繁触发,表明在小数据集场景下从 HashMap 切换到 ArrayMap/SparseArray 的优化收益是真实存在的 • 无文字 UI 是当前 LLM 动态分析的硬伤:钢琴类应用(纯图形按钮)3 小时内 LLM 仅执行 10 个动作,说明依赖语义理解的方案存在根本性局限 • 12.7% 的新增检测率意味着现有工具普遍低估了代码异味的真实规模 对 Android 性能优化工作的启示: 代码审查阶段应强制检查 onDraw() 中的对象分配和计算,将其标记为性能红线,因为 60fps 刷新频率会将任何额外开销放大 N 倍。NLMR 和 HMU 是当前召回率最高的两类异味(97% 和 73%),建议优先在代码规范中明确约束:所有 Activity 必须实现有效的 onLowMemory() 回调;所有 HashMap 使用处必须审查数据集预期大小,超过约 100 条记录才允许继续使用 HashMap。
1
1
272
30 Dec 2025
Fact for Day 10: The HashMap Tax. Using HashMap<Integer, Object> wastes memory because Integer is a heavy object wrapper. The Fix: Switch to Android's SparseArray. It maps raw int keys directly, completely skipping the object overhead to save massive RAM.
4
55
Advantages of SparseArray in Android Read here: outcomeschool.substack.com/p…
5
6
381
4 Nov 2025
Use SparseArray for small int/long maps to boost #Android #UI performance; switch to HashMap for larger workloads. droidcon.com/2025/10/17/opti…

2
12
568
Optimizing Android Performance: When to Use SparseArray, SparseIntArray, and ArrayMap Instead of HashMap. By Tung Doan #AndroidDev proandroiddev.com/optimizing…

5
18
1,178
🚀 Day 36 of #100DaysOfCode Today, I focused on two fundamental but very important concepts in JavaScript: naming practices and working with arrays. 🔹 Naming Variables & Functions Use camelCase for variables and functions (userName, getUserData). For booleans, add clarity with prefixes: isLoading, hasPermission, canEdit. Functions should start with verbs that describe the action: getUserProfile() → retrieving data setUserPreferences() → updating data handleClick() or onSubmit() → event handlers Arrays should usually use plural nouns to show they contain multiple items: users, colors, products. Goal: write self-explanatory code so you don’t need extra comments. 🔹 Arrays: Length & Initialization .length gives the number of elements: const fruits = ["apple", "banana", "orange"]; console.log(fruits.length); // 3 Arrays can have empty slots (sparse arrays): const sparseArray = [1, , , 4]; console.log(sparseArray.length); // 4 Ways to create arrays of fixed length: const emptyArray = new Array(5); // [,,,,] const fromArray = Array.from({ length: 5 }); // [undefined, ...] const filledArray = new Array(3).fill(0); // [0, 0, 0] ✨ Takeaway: Clean, consistent naming makes code easy to read and maintain. Arrays, with their length property and initialization methods, are powerful tools for structuring data efficiently.
Day 35 of #100DaysOfCode Today, on Strings in JavaScript, focusing on two important concepts: String Objects vs String Primitives and the toString() method. 🔹 String Objects vs Primitives A normal string like "Hello" is a primitive – lightweight, fast, and memory-efficient. But you can also create a string as an object using new String("Hello"). This returns an object, not a primitive. Even though primitives are not objects, JavaScript temporarily wraps them in an object so you can still use properties like .length or methods like .slice(). In practice, we almost always use string primitives, because they are more efficient. 🔹 The toString() Method Converts values into their string form. Example: const num = 10; console.log(num.toString()); // "10" console.log(num.toString(2)); // "1010" (binary) Arrays have their own custom .toString() that joins elements with commas. Objects return a default [object Object] unless you explicitly convert them with JSON.stringify(). ✨ Key takeaway: Understanding how JavaScript handles strings internally helps me write cleaner and more optimized code. Also, knowing how .toString() works across different data types makes debugging and formatting data much easier.
1
2
15
739
Here are the main advantages of using SparseArray: • Memory Efficiency: SparseArray avoids the overhead of autoboxing int to Integer. HashMap<Integer, Object> stores keys and values as objects, which consumes more memory.
1
4
145
In Android, SparseArray is a data structure that maps integer keys to objects, designed to be more memory-efficient than using a HashMap<Integer, Object>. SparseArray uses two parallel arrays internally (for keys and values) and binary search for lookups.
1
5
164
Advantages of SparseArray in Android: Thread 🧵
1
6
33
2,150
Here are the main advantages of using SparseArray: • Memory Efficiency: SparseArray avoids the overhead of autoboxing int to Integer. HashMap<Integer, Object> stores keys and values as objects, which consumes more memory.
1
4
96
In Android, SparseArray is a data structure that maps integer keys to objects, designed to be more memory-efficient than using a HashMap<Integer, Object>. SparseArray uses two parallel arrays internally (for keys and values) and binary search for lookups.
1
3
114
Advantages of SparseArray in Android: Thread 🧵
1
4
35
1,754
🚀 #ScikitLearn 1.7 is here! ✅ Smarter #SparseArray support ⚠️ Improved #ConvergenceWarnings 🔢 Full #ArrayAPI integration Upgrade now: pip install --upgrade scikit-learn #MachineLearning #Python #AI #DataScience #MLTools
1
42
Use the Right Data Structures • Use SparseArray, ArrayMap, etc, instead of HashMap where applicable.
1
2
51
4 Jan 2025
Replying to @cyrilmottier
Every Java/kotlin engineers should read about performance, memory and especially energy efficient coding practices. One such example can be using SparseArray from android.util in place of hashmaps with primitive key(Int) and many more little nuances to build really good apps.
1
5
525
Optimization Using ArrayMap and SparseArray amitshekhar.me/blog/optimiza… #androiddev

1
4
30
1,839
Can someone convert this to python from Mathematica for me please. 🙏 “ (* deeptemporalmemory.m *) R[f_Symbol, {n_Integer, p_Integer} ] := Module[ {T, x, y, z, overlap}, (* instantiate a triadic memory unit *) TriadicMemory[ T, {n, p}]; overlap[a_SparseArray, b_SparseArray] := Total[BitAnd[a, b]]; x = y = z = SparseArray[{0}, {n}]; (* reset x, y, z if input is zero *) f[SparseArray[{0}, {n}]] := x = y = z = SparseArray[{0}, {n}]; f[input_SparseArray] := Module[ {}, x = BitOr[y, z]; (* binarize x and y using ranked-max algorithm *) y = input; If[Total[x] > 0 && overlap[T[_, y, z = T[x, y, _]], x] < p, T[x, y, z = T[]]]; z ] ]; TemporalMemory[t_Symbol, {n_Integer, p_Integer}] := Module[{M, R1, R2, R3, R4, R5, R6, R7, x, y, z, t1, t2, t3, t4, t5, t6, t7, t8}, (* predictions / readout memory *) TriadicMemory[M, {n, p}]; (* bigram encoder units *) R[ #, {n, p}] & /@ {R1, R2, R3, R4, R5, R6, R7 }; (* initialize state variables with null vectors *) x = y = z = t1 = t2 = t3 = t4 = t5 = t6 = t7 = M[0]; t[inp_] := Module[ {}, (* flush state if input is zero - needed when used as a sequence memory *) If[Total[inp] == 0, x = y = z = M[0]]; (* store new prediction if necessary *) If[z != inp, M[x, y, inp]]; (* encoding chain *) t1 = R1[inp]; t2 = R2[t1]; t3 = R3[t2]; t4 = R4[t3]; t5 = R5[t4]; t6 = R6[t5]; t7 = R7[t6]; (* prediction readout from t1, t2, t4 and t7 *) z = M[x = BitOr[t1, t4], y = BitOr[t2, t7], _] ] ]; “
7
1
7
1,389
Design of Ultrasonic Synthetic Aperture Imaging Systems Based on a Non-Grid 2D Sparse Array mdpi.com/1424-8220/21/23/800… #sparsearray #syntheticapertureimaging #ultrasonicimaging
1
2