本文介绍了搜索文本文件中字符串的最快方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 在.NET中搜索大型磁盘文本文件(100 + MB)的最快*方法是什么? 给定字符串。 这些文件是未编入索引且未分类的,并且出于我当前的b $ b b要求的目的,无法编入索引/排序。 我不喜欢t想要将整个文件加载到物理内存中,内存映射文件 都可以(并且首选)。速度/性能是一项要求 - 目标是 在10 MB或更短的时间内找到100 MB文件的字符串。搜索字符串 通常为10个字符或更少。最后,我不想产生一个 外部可执行文件(例如grep),但是将算法/方法直接包含在.NET代码库的中。对于第一次转换,不需要通配符支持。 感谢您的任何指示!What is the *fastest* way in .NET to search large on-disk text files (100+ MB)for a given string.The files are unindexed and unsorted, and for the purposes of my immediaterequirements, can''t be indexed/sorted.I don''t want to load the entire file into physical memory, memory-mapped filesare ok (and preferred). Speed/performance is a requirement -- the target is tolocate the string in 10 seconds or less for a 100 MB file. The search stringis typically 10 characters or less. Finally, I don''t want to spawn out to anexternal executable (e.g. grep), but include the algorithm/method directly inthe .NET code base. For the first rev, wildcard support is not a requirement.Thanks for any pointers!推荐答案 这篇关于搜索文本文件中字符串的最快方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!