This paper explores the use of Chain-of-Thought (CoT) reasoning to improve the performance of large-scale language models (LLMs). CoT provides an intermediate step to improve accuracy and robustness in arithmetic, logic, and common sense tasks, but it comes at the cost of high computational costs. This problem is particularly acute in software engineering tasks that require concise and deterministic output. Based on code generation benchmarks, this paper conducts an experimental study and reveals that excessive CoT reasoning leads to reduced accuracy, increased latency, and output truncation. To address this issue, this paper proposes Self-Enhancing Efficient Reasoning (SEER), an adaptive framework that compresses CoT while maintaining accuracy. SEER combines best-of-N sampling and task-specific adaptive filtering to dynamically adjust thresholds based on pre-inference output, reducing verbosity and computational overhead. Evaluation results on three software engineering tasks and one mathematical task show that SEER shortens CoT by an average of 42.1%, improves accuracy, and eliminates most infinite loops.