当前位置: 首页 > news >正文

编程老鸟请注意

我发现getwc(fp)速度很慢。看了下文档:

The getwc() function or macro functions identically to fgetwc(). It may be implemented as a macro, and may evaluate its argument more than once. There is no reason ever to use it.

这倒罢了,字符转换比较麻烦,不能用宏实现可以想像。

过去的书上说getc是宏呢?

getc() is equivalent to fgetc() except that it may be implemented as a macro which evaluates stream more than once.

用下面的程序试了下:

~$ cat t.cpp
#include <stdio.h>
int xxx = getc(stdin);
int*	ppp = NULL;$ gcc -E t.cpp
# 2 "t.cpp"
int xxx = getc(
# 2 "t.cpp" 3 4stdin
# 2 "t.cpp");
int* ppp = 
# 3 "t.cpp" 3 4__null
# 3 "t.cpp";

getc也不是宏。

处理几个G的语料,调用getc几十亿次?!

The fgetws() function is the wide-character equivalent of the fgets(3) function.

我觉得搞NLP的基本上应该把语料都转成UTF-16编码,一次费事,次次受益。

但是GB18030里的生僻字用16位表示不了。

http://www.jsqmd.com/news/37821/

相关文章:

  • stm32使用SPI写W25Q32
  • 2025年济南画室培训机构最新推荐:济南画室/济南艺考画室/山东美术艺考培训/山东画室/专业教学,个性化辅导新标杆
  • Flutter零基础极速入门到进阶实战(视频教程) - 教程
  • 题解 P13524 [KOI 2025 #2] 跳跃
  • SOS DP
  • docker - 1 安装
  • 11月10日
  • 最小二乘困难详解5:非线性最小二乘求解实例
  • ##题解##洛谷P1578##最大子矩形 扫描线法
  • 【Azure Developer】azd 安装最新版无法登录中国区问题二:本地Windows环境遇问题
  • 密码校验函数
  • 英语_阅读_The progress of technology_待读
  • Mac 下载 VMware 11.1.0-1.dmg 后如何安装?超简单教程(附安装包)
  • 机动车登记证识别技术如何通过深度学习实现泛化能力提升
  • 在R中生成交互地图leaflet包
  • 深入解析:51单片机基础-矩阵按键
  • gmssl 国密标准下载
  • 没有路由器的情况下如何通过电脑网口连接开发板
  • 重练算法(代码随想录版) day 7 -哈希表part2
  • 团队作业2——《需求规格说明书》
  • gmssl常用命令 - 需要持续更新
  • 实用指南:根据用户行为数据中的判断列表在 Elasticsearch 中训练 LTR 模型
  • 转转客服IM聊天系统背后的技术挑战和实践分享
  • 英语_阅读_Computers_待读
  • 202511.11 - A
  • AT_arc160_c [ARC160C] Power Up
  • 英语_阅读_Life in cities_待读
  • 实验 5:ViT Swin Transformer
  • 一个强大的排序工具
  • 数据采集_2