11
votes
Accepted
Counting relevant entries in a large bioinformatics file
In order to speed this up, you'll need to avoid as many string creation operations as possible, because they are expensive. Especially the split operation is expensive. Not only does this create many ...
10
votes
Counting relevant entries in a large bioinformatics file
If you are in for raw performance, try to avoid repeating potentially cost-intensive operations.
In this case, you split the lines twice with the same parameter, which repeatedly applies a regular ...
9
votes
Accepted
Very simple CSV-parser in Java
Side-effects
Stream.forEach() operation should be utilized with care since it operates via side-effects and should not be used as a substitution of a proper ...
8
votes
Accepted
C++ string Formatter Again Part-1
First of all, this is remarkably good and clean code! Nevertheless, I do have some things to nitpick on:
Code Formatting
Let's talk about line length. As of right now, you have a (physical) line in ...
8
votes
Accepted
Overloading istream>> to read comma-separated input
95 percent of programming is looking for redundancies and eliminating them.
For example, why do you bother with reading strings into accusations[] first, and then ...
7
votes
Deflating a Stream using System.IO.Compression
I think you're doing too much in one function, hiding the big picture I'd want to read without going into the implementation details. I'd first start with a broad overview:
...
7
votes
Merge multiple map with java stream api
Some basic tips:
Split this into 2 methods, drop the enum. It doesn't do you any good unless something is really forcing you to have it there.
It will be a lot ...
7
votes
Accepted
Copy file with text replacement
std::getline and std::string are in the <string> header, so we need to include that.
...
6
votes
StreamIterable - create an iterable from a Java 8 Stream
As an Iterable is a functional interface with a method just returning the iterator, you could also write:
...
6
votes
Accepted
6
votes
Custom output stream that acts like std::cout
Construction
The construction of a MyStream object will proceed like this:
Construct std::ostream part with pointer to not-yet-...
6
votes
6
votes
Compare two map objects and show relative information Java 8
Code review in order of appearance:
public static String getAllExecTimes(MasterVO masterVO, boolean displayAll) {
Static methods should be avoided if you may ...
6
votes
Chunking strings to binary output
I agree with you that this would be more intuitive to use by chaining streams, rather than acting as a queue that must be pushed into and pulled out of. I've never written a filtering stream like ...
6
votes
Accepted
ostream that counts and discards the characters written to it
Areas of concern
Have I missed some important technical requirement when inheriting std::streambuf and std::ostream?
This is ...
6
votes
To markup a C++ std::ostream and delegate formatting of markuped text
About your API
To actually use your code, you have to write quite a few lines of code just to get one line printed. Consider your main() function:
...
6
votes
Accepted
Java: Benchmark findFirst() and findAny() methods on non-parallel streams
whether the benchmark has been implemented correctly
I'm afraid, no.
JVM does quite a bit of optimizations at runtime, compiling certain frequently called methods into highly optimized native code. ...
6
votes
Search values by priority in a Stream
There is absolutely no point in using streams for this or integers to represent the values. Don't complicate your life with streams just because you think they're cool. Streams are a hammer that make ...
6
votes
Very simple CSV-parser in Java
conservative design
Since this is billed as "a CSV parser", a caller may reasonably
believe they could send it any *.csv file produced by Excel.
Better to ...
5
votes
Accepted
Creating a pipeline operator in Java
This starts getting messy quickly, preventing authors from writing readable one-line expressions.
Based on this statement, I don't get, how you want to use your code. You definitely don't want to ...
5
votes
Accepted
Intersection of a Stream of Collections
Using built-ins
You can use built-in comparators instead of creating your own. For example
...
5
votes
Accepted
Nisse Server: Part 3 Stream Layer (attempt 2)
SocketStreamBuffer is really an input-streambuffer and an output-streambuffer which use the same members in a mutually incompatible way. It works if any instance is ...
5
votes
Accepted
C++ Range based stream
I don't like the name - it ought to be more explicit that it's an input-only range.
Otherwise, it looks just as a range should, with the observation that we omit the usual const iterators, as they ...
5
votes
C++ Range based stream
First of all, I would change the name to istream_range:
template<typename ValueType>
class istream_range
This will make ...
5
votes
Accepted
Using QXmlStreamReader to read configuration file of key-value pairs
Case for not using a class
It's not clear to me whether you need a class for what you are doing. Unless you need to be able to construct an instance of ...
5
votes
Stopping an infinite stream with collection state
Unit tests
Let's talk about your test assertions first. Your test claims:
...
5
votes
Sequencing Collector for Either
You are horrified by "the type of that thing" because you are using stream operations for something they were not meant for. The purpose of streams is to perform pre-defined operations on an arbitrary ...
5
votes
File encryption with password
Style
private const int _saltSizeBytes = 32;
private const int _IVSizeBytes = 16;
private const int _PBKDF2Iterations = 10000;
Initially, I wanted to comment that ...
5
votes
File encryption with password
var
AesManaged aesManaged = new AesManaged()
You can make you code less verbose by using var instead of explicit type ...
5
votes
Templated byte streaming
Well, there are a few points:
You make a copy of the object you output. That can be costly, impossible, or have undesirable side-effects. Use a constant reference instead.
There are essentially two ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
stream × 323java × 123
c++ × 91
c# × 56
performance × 20
file × 19
io × 19
functional-programming × 16
lambda × 15
strings × 14
c++11 × 14
beginner × 12
python × 10
algorithm × 10
c × 10
parsing × 10
formatting × 10
c++14 × 10
socket × 10
serialization × 9
tcp × 9
javascript × 8
console × 7
.net × 6
concurrency × 6