A
A
aeaeae12020-11-03 23:28:20
Qt
aeaeae1, 2020-11-03 23:28:20

Which is better for working with QT or C# files?

I have written two programs to search files with large amounts of data. One in QT + C++ and the other in C#. But qt downloads files in 5 minutes and C# 30 in minutes. What could be the reason?
And in general, which is better for working with large files QT or C#? Please list the advantages and disadvantages of both.

Answer the question

In order to leave comments, you need to log in

6 answer(s)
A
Adamos, 2020-11-04
@Adamos

Perhaps high-level functions are used without understanding how they are implemented at a low level.
For example, if a Qt program reads a file in chunks, displaying into memory only what it is currently reading, and a Sharp program reads the entire file into memory and only then starts searching through it, a sixfold difference is quite possible even with a completely identical implementation of the actual search algorithm.

G
Grish Poghosyan, 2020-11-04
@hovsepyann

Well, of course, the option written on the pluses will work faster.
And why the first option works 6 times faster, I can’t say (wang) yet. It is necessary to look at the implementation of the second option.

M
maaGames, 2020-11-04
@maaGames

Based on the formulation of the question, I am 99% sure of the clumsy implementation of the search algorithm in both languages. I recommend to google about the substring search algorithm using the Knuth-Morris-Pratt method. The larger the search string, the faster the search will be performed (depending on the contents of the substring, but generally faster).

V
veydlin, 2020-11-04
@veydlin

On Sharp, development is many times faster, I would suggest a hybrid option:
Write a dll in C ++ and connect it to Sharp

V
Vladimir Korotenko, 2020-11-04
@firedragon

I have written two programs to search files with large amounts of data. One in QT + C++ and the other in C#. But qt downloads files in 5 minutes and C# 30 in minutes. What could be the reason?
And in general, which is better for working with large files QT or C#? Please list the advantages and disadvantages of both.

It's impossible to say without seeing the code. Although I would advise asynchronous input for really large files or stupid reading into memory for small ones in synchronous mode.
Small ones are less than 50 megabytes.

B
basrach, 2020-11-08
@basrach

> What is best for working with files The
best is what you have more experience in, and what most of the "working" projects are written on. If everything else is written in Qt, then you should definitely not write file reading in C#, and vice versa.
> What could be the reason?
The reason may be in the implementation curve in C#. Reading files in any language relies on the mechanisms of the OS, there can be no difference by 6 times if only reading as such is measured. Either you measured something wrong, or one of the two.
> Please list the advantages and disadvantages of both.
Whether this or that feature is an advantage or a disadvantage depends on how you look at it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question