Questions tagged [optimization]
58 questions
26
votes
4 answers
How to compile without optimizations -O0 using CMake
I am using Scientific Linux (SL). I am trying to compile a project that uses a bunch of C++ (.cpp) files.
In the directory user/project/Build, I enter make to compile and link all the .cpp files. I then have to go to user/run/ and then type…
user4352158
- 431
- 2
- 6
- 9
20
votes
1 answer
Why can the kernel not use SSE/AVX registers and instructions?
This post from StackOverflow has this,
In some environments there there is a restriction on certain instructions or using certain registers. For example, in the Linux kernel, use of SSE/AVX or FP registers is generally disallowed. Therefore most of…
Evan Carroll
- 28,578
- 45
- 164
- 290
19
votes
5 answers
Compress a large number of large files fast
I have about 200 GB of log data generated daily, distributed among about 150 different log files.
I have a script that moves the files to a temporary location and does a tar-bz2 on the temporary directory.
I get good results as 200 GB logs are…
anu
- 332
- 1
- 2
- 8
11
votes
1 answer
How does ksh93 avoid forks in command substitution
Given
cmd='fun(){ echo "$@"; }; fun $(fun $(fun hi))'
shells tend to need to make 2 forks to make it happen
strace-f(){ strace -f "$@" 2>&1; };
for sh in dash bash zsh ksh; do
printf "$sh\t" ; strace-f $sh -c "$cmd" |grep -e clone -e fork…
Petr Skocik
- 28,176
- 14
- 81
- 141
7
votes
3 answers
Do file descriptors optimise writing to files?
Is it equivalent to have commands print to a file directly, as opposed to writing to a file descriptor?
Illustration
Writing to file directly:
for i in {1..1000}; do >>x echo "$i"; done
Using an fd:
exec 3>&1 1>x
for i in {1..1000}; do echo "$i";…
user147505
6
votes
1 answer
How to create a configuration to only connect to WiFi if signal is ≥ 30 %?
Is there any chance to create a configuration that does the following job?
Only connect to available WiFi if it's signal is stronger than 30 %
At many places, I stay in the border area of barely available wifi-signals. Thereupon those inevitable…
Dave
- 996
- 4
- 17
- 36
6
votes
1 answer
SSD optimization
I know this has been discussed many times, but there are a lot of different opinions across the internet which optimizations are good for SSDs (and whether to use them). Also the technology has advanced and some of the advices might have become…
NefariousOctopus
- 491
- 6
- 22
5
votes
4 answers
How to calculate the memory consumed by a "C" program in linux
I have written two C programmes
one is using function pointer, and
the other without function pointer.
Now i want to know the memory consumed by the two programmes , to see how memory can optimized.
Nagraj
- 51
- 1
- 1
- 2
5
votes
3 answers
Allocating Swap Space with KVM
Consider the following scenario: a host with 2 GiB runs a few guests using KVM. Each guest does usually not need much memory; they are given 256 MiB each and run services that mostly twiddle their thumbs.
However, occasionally the guests need more…
countermode
- 7,373
- 5
- 31
- 58
4
votes
1 answer
Is there an equivalent to Jason Randolph's Super Duper mode vim re-mapping for Linux?
I'm very interested in moving from my Mac to a Linux system. The main barrier is my dependence on Jason Rudolph's Keyboard. Specifically, I need an equivalent to (S)uper (D)uper Mode. Super Duper activates vim-like keybindings when the keys "s" and…
Beasta
- 41
- 3
4
votes
1 answer
Fastest way to count zero bytes on a partition
My root and home partitions are LUKS-encrypted. I wish to have discard/TRIM enabled on them (I'm aware of security implications). If my understanding is correct, this should result in discarded areas being zeros on a raw disk device and gibberish on…
gronostaj
- 678
- 1
- 8
- 18
4
votes
3 answers
Script optimisation to find duplicates filename in huge CSV
I have several CSV file from 1MB to 6GB generated by inotify script with a list of events formatted as is:
timestamp;fullpath;event;size.
Those files are formatted like this…
Kiwy
- 9,415
- 13
- 49
- 79
4
votes
2 answers
How to force a Thinkpad to draw charge from internal vs external battery?
My T450s Thinkpad has two built-in batteries--one hot-swappable and one inside the laptop. Lenovo calls the former "external" and the latter "internal". When not plugged in, the external battery provides charge until it hits a 5% low water mark, at…
Stan
- 41
- 1
- 3
4
votes
2 answers
How do I write a script to automatically optimize all the PNGs in my MediaWiki images directory?
I have MediaWiki 1.25.2 installed on my 64-bit Debian 8.1 VirtualBox machine and I'd like to be able to upload the images/ directory from this installation to my DropBox. Being a cheapskate I'm trying to minimize the size of this images directory by…
Josh Pinto
- 3,483
- 15
- 52
- 87
4
votes
2 answers
CPU optimized compiled debian packages
I really don't know how the Debian maintainers check for all the bugs in every release of Debian, but isn't it the case that if all codes for every package have been patched up and tested for all CPU architectures listed, then releasing them with…
Dehbop
- 4,259
- 3
- 11
- 7